package com.ufgov.zc.client.zc.zcppromake;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_FUND_CODE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ORIGIN_CODE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_CATALOGUE_CODE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_CO_CODE_ND;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_CO_NAME;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_FGKZBFS_SMWJ;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_FUKUAN_TYPE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_IS_IMP;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_IS_REMARK;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_MAKE_CODE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_MAKE_LINKMAN;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_MAKE_NAME;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_MAKE_STATUS;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_MAKE_TEL;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_MONEY_BI_SUM;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_PIFU_CGFS;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_PITEM_ARR_DATE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_PITEM_OPIWAY;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_TRUST_AGEY_CODE;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_TRUST_AGEY_NAME;import static com.ufgov.zc.common.system.constants.ZcElementConstants.FIELD_TRANS_ZC_ZG_CS_CODE;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Component;import java.awt.DefaultKeyboardFocusManager;import java.awt.Dialog.ModalityType;import java.awt.Dimension;import java.awt.Font;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.math.BigDecimal;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JComponent;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JSplitPane;import javax.swing.JTabbedPane;import javax.swing.JTable;import javax.swing.JTextField;import javax.swing.border.TitledBorder;import javax.swing.event.TableModelEvent;import javax.swing.event.TableModelListener;import javax.swing.table.TableModel;import org.apache.commons.lang.ObjectUtils;import org.apache.log4j.Logger;import com.ufgov.smartclient.common.UIUtilities;import com.ufgov.smartclient.component.table.fixedtable.JPageableFixedTable;import com.ufgov.zc.client.common.AsOptionMeta;import com.ufgov.zc.client.common.BillElementMeta;import com.ufgov.zc.client.common.LangTransMeta;import com.ufgov.zc.client.common.ListCursor;import com.ufgov.zc.client.common.MyTableModel;import com.ufgov.zc.client.common.ServiceFactory;import com.ufgov.zc.client.common.WorkEnv;import com.ufgov.zc.client.common.converter.zc.ZcPProMakeToTableModelConverter;import com.ufgov.zc.client.component.AsValComboBox;import com.ufgov.zc.client.component.DateField;import com.ufgov.zc.client.component.GkBaseDialog;import com.ufgov.zc.client.component.GkCommentDialog;import com.ufgov.zc.client.component.GkCommentUntreadDialog;import com.ufgov.zc.client.component.JBasePanel;import com.ufgov.zc.client.component.JFuncToolBar;import com.ufgov.zc.client.component.JSaveableSplitPane;import com.ufgov.zc.client.component.JTablePanel;import com.ufgov.zc.client.component.MoneyField;import com.ufgov.zc.client.component.button.AddButton;import com.ufgov.zc.client.component.button.AuditPassButton;import com.ufgov.zc.client.component.button.CallbackButton;import com.ufgov.zc.client.component.button.CancelButton;import com.ufgov.zc.client.component.button.ChengJiaoButton;import com.ufgov.zc.client.component.button.ChengJiaoGongGaoButton;import com.ufgov.zc.client.component.button.ConfirmSupplyButton;import com.ufgov.zc.client.component.button.DeleteButton;import com.ufgov.zc.client.component.button.ExitButton;import com.ufgov.zc.client.component.button.FuncButton;import com.ufgov.zc.client.component.button.JingJiaGongGaoButton;import com.ufgov.zc.client.component.button.NextButton;import com.ufgov.zc.client.component.button.PreviousButton;import com.ufgov.zc.client.component.button.PrintButton;import com.ufgov.zc.client.component.button.PrintPreviewButton;import com.ufgov.zc.client.component.button.PrintSettingButton;import com.ufgov.zc.client.component.button.SaveButton;import com.ufgov.zc.client.component.button.SendButton;import com.ufgov.zc.client.component.button.SubaddButton;import com.ufgov.zc.client.component.button.SubdelButton;import com.ufgov.zc.client.component.button.SubinsertButton;import com.ufgov.zc.client.component.button.SuggestAuditPassButton;import com.ufgov.zc.client.component.button.SuggestAuditPassCZButton;import com.ufgov.zc.client.component.button.TraceButton;import com.ufgov.zc.client.component.button.UnauditButton;import com.ufgov.zc.client.component.button.UntreadButton;import com.ufgov.zc.client.component.table.BeanTableModel;import com.ufgov.zc.client.component.table.celleditor.DateCellEditor;import com.ufgov.zc.client.component.table.celleditor.MoneyCellEditor;import com.ufgov.zc.client.component.table.celleditor.TextCellEditor;import com.ufgov.zc.client.component.table.celleditor.zc.ZcBCatalogueCellEditor;import com.ufgov.zc.client.component.table.cellrenderer.DateCellRenderer;import com.ufgov.zc.client.component.table.cellrenderer.NumberCellRenderer;import com.ufgov.zc.client.component.table.codecelleditor.AsValComboBoxCellEditor;import com.ufgov.zc.client.component.table.codecelleditor.FileCellEditor;import com.ufgov.zc.client.component.table.codecellrenderer.AsValCellRenderer;import com.ufgov.zc.client.component.ui.conditionitem.AsValComboboxConditionItem2;import com.ufgov.zc.client.component.ui.fieldeditor.AbstractFieldEditor;import com.ufgov.zc.client.component.zc.AbstractMainSubEditPanel;import com.ufgov.zc.client.component.zc.fieldeditor.AsValFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.AutoNumFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.CompanyFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.DateFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.FileFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.ForeignEntityFieldCellEditor;import com.ufgov.zc.client.component.zc.fieldeditor.ForeignEntityFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.MoneyFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.NewLineFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.OrgFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.TextAreaFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.TextFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.TextFilePathFieldEditor;import com.ufgov.zc.client.print.PrintSettingDialog;import com.ufgov.zc.client.util.SwingUtil;import com.ufgov.zc.client.zc.ZcUtil;import com.ufgov.zc.common.commonbiz.fieldmap.FieldMapRegister;import com.ufgov.zc.common.commonbiz.model.BillElement;import com.ufgov.zc.common.commonbiz.model.Company;import com.ufgov.zc.common.commonbiz.model.MaCompany;import com.ufgov.zc.common.commonbiz.model.MaCompanyKey;import com.ufgov.zc.common.commonbiz.model.WfAware;import com.ufgov.zc.common.commonbiz.publish.IBaseDataServiceDelegate;import com.ufgov.zc.common.system.Guid;import com.ufgov.zc.common.system.RequestMeta;import com.ufgov.zc.common.system.constants.ZcElementConstants;import com.ufgov.zc.common.system.constants.ZcSettingConstants;import com.ufgov.zc.common.system.dto.ElementConditionDto;import com.ufgov.zc.common.system.model.AsVal;import com.ufgov.zc.common.system.util.DigestUtil;import com.ufgov.zc.common.system.util.ObjectUtil;import com.ufgov.zc.common.system.util.Utils;import com.ufgov.zc.common.zc.checkrule.BaseRule;import com.ufgov.zc.common.zc.checkrule.ZcMakeCheckRule;import com.ufgov.zc.common.zc.foreignentity.IForeignEntityHandler;import com.ufgov.zc.common.zc.foreignentity.IForeignEntityTreeHandler;import com.ufgov.zc.common.zc.model.ZcBAgency;import com.ufgov.zc.common.zc.model.ZcBBrand;import com.ufgov.zc.common.zc.model.ZcBMerchandise;import com.ufgov.zc.common.zc.model.ZcBaseBill;import com.ufgov.zc.common.zc.model.ZcEbSupplier;import com.ufgov.zc.common.zc.model.ZcPProMake;import com.ufgov.zc.common.zc.model.ZcPProMitem;import com.ufgov.zc.common.zc.model.ZcPProMitemBaoJia;import com.ufgov.zc.common.zc.model.ZcPProMitemBi;import com.ufgov.zc.common.zc.model.ZcVBiDetail;import com.ufgov.zc.common.zc.publish.IZcEbBaseServiceDelegate;import com.ufgov.zc.common.zc.publish.IZcPProMakeServiceDelegate;import freemarker.core.StopException;/** *  *  *  * @author Administrator *  *  */@SuppressWarnings("unchecked")public class ZcPProMakeEditPanel extends AbstractMainSubEditPanel {  public static final long serialVersionUID = -2779110682087878491L;  public static final Logger logger = Logger.getLogger(ZcPProMakeEditPanel.class);  public RequestMeta requestMeta = WorkEnv.getInstance().getRequestMeta();  public FuncButton addButton = new AddButton();  public FuncButton previousButton = new PreviousButton();  public FuncButton saveButton = new SaveButton();  public FuncButton deleteButton = new DeleteButton();  public FuncButton nextButton = new NextButton();  public FuncButton exitButton = new ExitButton();  public FuncButton cancelButton = new CancelButton();  /*   *    * 成交   */  public FuncButton chengJiaoButton = new ChengJiaoButton();  // 工作流送审  public FuncButton sendButton = new SendButton();  // 工作流收回  public FuncButton callbackButton = new CallbackButton();  // 工作流填写意见审核通过  public FuncButton suggestPassButton = new SuggestAuditPassButton();  // 工作流填写意见审核通过(送采购单位)  public FuncButton suggestPassCZButton = new SuggestAuditPassCZButton();  // 工作流审核通过  public FuncButton auditPassButton = new AuditPassButton();  // 工作流销审  public FuncButton unAuditButton = new UnauditButton();  // 工作流退回  public FuncButton unTreadButton = new UntreadButton();  // 工作流流程跟踪  public FuncButton traceButton = new TraceButton();  private PrintButton printButton = new PrintButton();  private PrintPreviewButton printPreviewButton = new PrintPreviewButton();  private PrintSettingButton printSettingButton = new PrintSettingButton();  private JingJiaGongGaoButton jingJiaGongGaoButton = new JingJiaGongGaoButton();  private ChengJiaoGongGaoButton chengJiaoGongGaoButton = new ChengJiaoGongGaoButton();  private ConfirmSupplyButton confirmSupplyButton = new ConfirmSupplyButton();  protected ListCursor listCursor;  public ZcPProMake oldZcPProMake;  public String tabStatus;  public ZcPProMakeListPanel listPanel;  public JTablePanel biTablePanel = new JTablePanel();  public JTablePanel jinJiaSummaryTablePanel = new JTablePanel();  public JTablePanel itemTablePanel = new JTablePanel();  public JBasePanel jinJiaPanel = new JBasePanel("jinJiaPanel");  public JBasePanel chengJiaoPanel = new JBasePanel("chengJiaoPanel");  public JBasePanel noShipReasonPanel = new JBasePanel("noShipReasonPanel");  public ZcPProMakeEditPanel self = this;  public GkBaseDialog parent;  JTabbedPane biTabPane = null;  JTabbedPane itemTabPane = null;  public ElementConditionDto brandDto;  public ElementConditionDto merDto;  protected ElementConditionDto getDto = new ElementConditionDto();  public JSaveableSplitPane splitPane;  public boolean hasCreateJinjiaPanel = false;  MoneyFieldEditor zcMoneyBiSum;  AsValFieldEditor zcMakeSequence;  AsValFieldEditor zcMakePfSequence;  AsValFieldEditor zcPitemOpiway;  AsValFieldEditor zcIsImp;  FileFieldEditor zcImpFile;  AsValFieldEditor zcPifuCgfs;  CompanyFieldEditor zcCoCode;  TextFieldEditor zcAttr3; // 协议二次竞价-竞价品牌  DateFieldEditor df; // 电子竞价-协议竞价截止时间  JFuncToolBar bottomToolBar1 = null;  JFuncToolBar bottomToolBar2 = null;  public String getTitle() {    return LangTransMeta.translate(ZcElementConstants.FIELD_TRANS_ZC_MAKE_TITEL);  }  IBaseDataServiceDelegate baseDataServiceDelegate = (IBaseDataServiceDelegate) ServiceFactory.create(IBaseDataServiceDelegate.class,  "baseDataServiceDelegate");  public IZcEbBaseServiceDelegate zcEbBaseServiceDelegate = (IZcEbBaseServiceDelegate) ServiceFactory.create(IZcEbBaseServiceDelegate.class,    "zcEbBaseServiceDelegate");  public HashMap<ZcPProMitemBaoJia, ZcPProMakeJinJiaEditPanel> jinJiaPanelMap = new HashMap<ZcPProMitemBaoJia, ZcPProMakeJinJiaEditPanel>();  public ZcPProMitemBaoJia currentChengJiao;  public AsVal asVal = new AsVal();  public boolean haveInitFlag = false;  public String getCompoId() {    return "ZC_P_PRO_MAKE";  }  public ZcPProMakeEditPanel(GkBaseDialog parent, ListCursor listCursor, String tabStatus, ZcPProMakeListPanel listPanel) {    super(ZcPProMake.class, BillElementMeta.getBillElementMetaWithoutNd("ZC_P_PRO_MAKE"));    this.listCursor = listCursor;    this.tabStatus = tabStatus;    this.listPanel = listPanel;    this.workPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), getTitle(), TitledBorder.CENTER, TitledBorder.TOP,    new Font("宋体", Font.BOLD, 15), Color.BLUE));    this.parent = parent;    this.colCount = 3;    init();    requestMeta.setCompoId(getCompoId());       unAuditButton.setVisible(false);    refreshData();    // start    ZcPProMake make1 = (ZcPProMake) this.listCursor.getCurrentObject();    if ("exec".equals(make1.getZcMakeStatus())) { // 如果是终审状态，直接将销审按钮设置为可见      // unAuditButton.setVisible(true);    }    if ("exec".equals(make1.getZcMakeStatus())) { // 如果是终审状态，直接将退回按钮设置为不可见      unTreadButton.setVisible(false);    }    // end    stopTableEditing();    this.haveInitFlag = true;    if (!ZcUtil.useBudget()) {      List biNotNullList = listPanel.biBillElementMeta.getNotNullBillElement();      for (int i = 0; i < biNotNullList.size(); i++) {        BillElement b = (BillElement) biNotNullList.get(i);        if ("ZC_BI_NO".equals(b.getElementCode())) {          biNotNullList.remove(b);        }      }    }  }  public ZcPProMakeEditPanel(Class<ZcPProMake> class1, BillElementMeta billElementMetaWithoutNd) {    super(ZcPProMake.class, billElementMetaWithoutNd);      }  protected void initFieldEditorPanel() {    fieldEditors = createFieldEditors();    int row = 0;    int col = 0;    fieldEditorPanel.setLayout(new GridBagLayout());    for (int i = 0; i < fieldEditors.size(); i++) {      AbstractFieldEditor comp = fieldEditors.get(i);      if (comp.isVisible()) {        if (comp instanceof NewLineFieldEditor) {          row++;          col = 0;          continue;        } else if (comp instanceof TextAreaFieldEditor) {          // 转到新的一行          row++;          col = 0;          JLabel label = new JLabel(getLabelText(comp));          comp.setPreferredSize(new Dimension(150, comp.getOccRow() * 26));          fieldEditorPanel.add(label, new GridBagConstraints(col, row, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(          4, 0, 4, 4), 0, 0));          fieldEditorPanel.add(comp, new GridBagConstraints(col + 1, row, comp.getOccCol(), comp.getOccRow(), 1.0, 1.0, GridBagConstraints.WEST,          GridBagConstraints.HORIZONTAL, new Insets(4, 0, 4, 4), 0, 0));          // 将当前所占的行空间偏移量计算上          row += comp.getOccRow();          col = 0;          continue;        }        JLabel label = new JLabel(comp.getName());        comp.setPreferredSize(new Dimension(150, 23));        fieldEditorPanel.add(label, new GridBagConstraints(col, row, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,        0, 5, 5), 0, 0));        fieldEditorPanel.add(comp, new GridBagConstraints(col + 1, row, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,        new Insets(5, 0, 5, 5), 0, 0));        if (col == colCount * 2 - 2) {          row++;          col = 0;        } else {          col += 2;        }      }    }  }  public boolean isNotNullField(Class billClass, String fieldName, List<BillElement> notNullFields) {    for (BillElement billElement : notNullFields) {      String name = null;      try {        name = (String) FieldMapRegister.get(billClass).get(billElement.getElementCode());        if (name == null || "".equals(name.trim())) {          name = ZcUtil.convertColumnToField(billElement.getElementCode());        }      } catch (RuntimeException e) {        name = ZcUtil.convertColumnToField(billElement.getElementCode());      }      if (name.equalsIgnoreCase(fieldName))        return true;    }    return false;  }  public String getLabelText(AbstractFieldEditor comp) {    StringBuffer buff = new StringBuffer();    buff.append("<html><a>&nbsp;");    buff.append(comp.getName());    if (comp.getMaxContentSize() <= 0) {      buff.append("</a></html>");    } else {      if (comp.getOccRow() >= 2) {        buff.append("<br>(");      } else {        buff.append("(");      }      buff.append(comp.getMaxContentSize());      buff.append("字内)</a></html>");    }    return buff.toString();  }  @Override  public List<AbstractFieldEditor> createFieldEditors() {    List<AbstractFieldEditor> editorList = new ArrayList<AbstractFieldEditor>();    AutoNumFieldEditor zcMakeCode = new AutoNumFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_CODE), "zcMakeCode");    editorList.add(zcMakeCode);    TextFieldEditor zcMakeName = new TextFilePathFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_NAME), "zcMakeName");    editorList.add(zcMakeName);    AsValFieldEditor zcMakeStatus = new AsValFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_STATUS), "zcMakeStatus", "ZC_VS_MAKE_STATUS");    zcMakeStatus.setEnabled(false);    editorList.add(zcMakeStatus);    IForeignEntityTreeHandler companyHandler = new IForeignEntityTreeHandler() {      @Override      public void excute(List selectedDatas) {        ZcPProMake zcPProMake = (ZcPProMake) listCursor.getCurrentObject();        if (selectedDatas != null && selectedDatas.size() > 0) {          Company company = (Company) selectedDatas.get(0);          zcPProMake.setOrgCode(company.getForgCode());          setEditingObject(zcPProMake);        }      }      @Override      public boolean isMultipleSelect() {        return false;      }      @Override      public boolean isSelectLeaf() {        return false;      }    };    zcCoCode = new CompanyFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_CO_NAME), "coCode", companyHandler, getCompoId(), "CO_CODE");    zcCoCode.setEnabled(false);    editorList.add(zcCoCode);    // zcCoCode.setEnabled(true);    TextFieldEditor zcCoCodeNd = new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_CO_CODE_ND), "nd");    zcCoCodeNd.setEnabled(false);    editorList.add(zcCoCodeNd);    OrgFieldEditor zcZgCsCode = new OrgFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_ZG_CS_CODE), "orgCode", false);    editorList.add(zcZgCsCode);    TextFieldEditor zcMakeLinkman = new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_LINKMAN), "zcMakeLinkman");    editorList.add(zcMakeLinkman);    TextFieldEditor zcMakeTel = new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_TEL), "zcMakeTel");    editorList.add(zcMakeTel);    TextFieldEditor zcAttr2 = new TextFieldEditor(LangTransMeta.translate(ZcElementConstants.FIELD_TRANS_ZC_ATTR2), "zcAttr2");    editorList.add(zcAttr2);    zcMoneyBiSum = new MoneyFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MONEY_BI_SUM), "zcMoneyBiSum");    zcMoneyBiSum.setEnabled(false);    editorList.add(zcMoneyBiSum);    String columNames[] = { "委托机构代码", "委托机构名称" };    ZcAgeyFnHandler handler = new ZcAgeyFnHandler(columNames);    ElementConditionDto elementCondtiontDto = new ElementConditionDto();    elementCondtiontDto.setBillStatus("1");    ForeignEntityFieldEditor zcAgeyCode = new ForeignEntityFieldEditor("ZC_B_AGENCY.getZcBAgencyWithFN", elementCondtiontDto, 20, handler,    columNames, LangTransMeta.translate(FIELD_TRANS_ZC_TRUST_AGEY_CODE), "agency") {      public static final long serialVersionUID = -7737549222488261602L;      @Override      public void setValue(Object value) {        ZcPProMake make = (ZcPProMake) value;        if (make.getAgency() == null) {          field.setText(null);          field.setToolTipText(null);        } else {          field.setText(make.getAgencyName());          field.setToolTipText("[" + make.getAgency() + "]" + make.getAgencyName());        }      }      @Override      public Object getValue() {        return this.field.getText();      }    };    TextFieldEditor zcAgeyName = new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_TRUST_AGEY_NAME), "agencyName");    zcAgeyName.setVisible(false);    zcAgeyName.setEnabled(false);    editorList.add(zcAgeyCode);    editorList.add(zcAgeyName);    // 采购类型 （G02定协议供货二次竞价,G01协议供货,Z01项目采购,F03 分散采购）    AsValFieldEditor zcFukuanType = new AsValFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_FUKUAN_TYPE), "zcFukuanType", "ZC_VS_FUKUAN_TYPE") {      @Override      protected void afterChange(AsValComboBox field) {        String valId = field.getSelectedAsVal().getValId();        // 分散采购        if (ZcPProMake.CAIGOU_TYPE_FSCG.equals(valId)) {// wangwei add          // 2011-04-07-23:00          haveInitFlag = false;          ZcPProMake beanData = (ZcPProMake) listCursor.getCurrentObject();          beanData.setZcPitemOpiway("3");          beanData.setZcPifuCgfs("3");          setEditingObject(beanData);          haveInitFlag = true;        } else if (!ZcPProMake.CAIGOU_TYPE_XIANGMU.equals(valId) && haveInitFlag) {          // 如果不是（Z01项目采购）          haveInitFlag = false;          ZcPProMake beanData = (ZcPProMake) listCursor.getCurrentObject();          beanData.setZcMakeSequence("1");          beanData.setZcPitemOpiway("1");          beanData.setZcPifuCgfs("1");          setEditingObject(beanData);          df.setVisible(true);          zcPifuCgfs.setEnabled(false);          zcPitemOpiway.setEnabled(false);          haveInitFlag = true;        } else {          // 项目采购          zcPitemOpiway.setEnabled(true);        }        self.refreshJinJiaChengJiao();      }    };    editorList.add(zcFukuanType);    // 拟定采购方式 (1公开招标,2邀请招标,3竞争性谈判,4单一来源采购,5询价,6其他)    zcPitemOpiway = new AsValFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_PITEM_OPIWAY), "zcPitemOpiway", "ZC_VS_PITEM_OPIWAY");    zcPitemOpiway.getField().addItemListener(new ItemListener() {      public void itemStateChanged(ItemEvent event) {        if (event.getStateChange() == ItemEvent.SELECTED && haveInitFlag) {          /* 拟定采购方式和批复采购方式联动 */          haveInitFlag = false;          String valId = ((AsValComboBox) zcPitemOpiway.getField()).getSelectedAsVal().getValId();          ZcPProMake data = (ZcPProMake) listCursor.getCurrentObject();          data.setZcPitemOpiway(valId);          data.setZcPifuCgfs(valId);          setEditingObject(data);          zcPifuCgfs.setEnabled(false);          haveInitFlag = true;        }      }    });    editorList.add(zcPitemOpiway);    // 批复采购方式 ( 1公开招标,2邀请招标,3竞争性谈判,4单一来源采购,5询价,6其他)    zcPifuCgfs = new AsValFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_PIFU_CGFS), "zcPifuCgfs", "ZC_VS_PITEM_OPIWAY");    // zcPifuCgfs.setEnabled(true);    editorList.add(zcPifuCgfs);    FileFieldEditor zcFgkzbfsSmwj = new FileFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_FGKZBFS_SMWJ), "zcFgkzbfsSmwj", "zcFgkzbfsSmwjBlobid");    editorList.add(zcFgkzbfsSmwj);    AsValFieldEditor zcIsImp = new AsValFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_IS_IMP), "zcIsImp", "VS_Y/N");    editorList.add(zcIsImp);    FileFieldEditor zcImpFile = new FileFieldEditor("进出口相关附件", "zcImpFile", "zcImpFileBlobid");    editorList.add(zcImpFile);    AsValFieldEditor zcIsBudget = new AsValFieldEditor("是否公开预算", "zcIsBudget", "VS_Y/N");// //////////    editorList.add(zcIsBudget);    TextFieldEditor zcIsRemark = new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_IS_REMARK), "zcIsRemark");    editorList.add(zcIsRemark);    // df = new DateFieldEditor("协议竞价截止时间", "zcXieYiEndDate",    // DateFieldEditor.TimeTypeH24);//因为协议有专门的部件，先将此输入框注释， by wangwei    // editorList.add(df);    ZcPProHandler zcPProHandler = new ZcPProHandler(self, this.listCursor);    ElementConditionDto proDto = new ElementConditionDto();    proDto.setZcText0(this.requestMeta.getEmpCode());    ForeignEntityFieldEditor proName = new ForeignEntityFieldEditor("ZC_P_PRO.getZcPPro", proDto, 20, zcPProHandler,    zcPProHandler.getColumNames(), "预算项目", "proName");    editorList.add(proName);    return editorList;  }  @Override  public JTablePanel[] getSubTables() {    return new JTablePanel[] { biTablePanel, itemTablePanel };  }  public void setListDefaultValue(AsValComboboxConditionItem2 asValComboboxConditionItem2) {    if ("VS_Y/N".equals(asVal.getValSetId())) {      asValComboboxConditionItem2.setValue(null);    }  }  public void setItemBiDefaultValue(ZcPProMitemBi zcPProMitemBi) {    zcPProMitemBi.setOriginCode("99");// 指标来源,值集：ZC_VS_ORIGIN_NAME     zcPProMitemBi.setOriginName("自筹资金");    zcPProMitemBi.setFundCode("0");//资金性质,值集：ZC_VS_FUND_NAME    zcPProMitemBi.setFundName("自筹资金");//资金性质,值集：ZC_VS_FUND_NAME    zcPProMitemBi.setPaytypeCode("A");//支付方式, 值集：ZC_VS_PAYTYPE_NAME  }  public void setItemDefaultValue(ZcPProMitem zcPProMitem) {  }  @Override  public JComponent createSubBillPanel() {    biTabPane = new JTabbedPane();    biTablePanel = new JTablePanel(null, AsOptionMeta.getOptVal(ZcSettingConstants.ZC_OPTON_JIHUA_ZIJIN_HELP_MSG));    biTablePanel.init();    biTablePanel.getSearchBar().setVisible(false);    biTablePanel.setTablePreferencesKey(this.getClass().getName() + "_biTable");    biTablePanel.getTable().setShowCheckedColumn(true);    biTablePanel.getTable().getTableRowHeader().setPreferredSize(new Dimension(60, 0));    biTabPane.addTab("资金构成", biTablePanel);    bottomToolBar1 = new JFuncToolBar();    FuncButton addBtn1 = new SubaddButton(false);    JButton insertBtn1 = new SubinsertButton(false);    JButton delBtn1 = new SubdelButton(false);    bottomToolBar1.add(addBtn1);    bottomToolBar1.add(insertBtn1);    bottomToolBar1.add(delBtn1);    biTablePanel.add(bottomToolBar1, BorderLayout.SOUTH);    addBtn1.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        ZcPProMitemBi zcPProMitemBi = new ZcPProMitemBi();        zcPProMitemBi.setTempId(Guid.genID());        setItemBiDefaultValue(zcPProMitemBi);        // setListDefaultValue(asVal);        int rowNum = addSub(biTablePanel, zcPProMitemBi);        biTablePanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    insertBtn1.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        ZcPProMitemBi zcPProMitemBi = new ZcPProMitemBi();        zcPProMitemBi.setTempId(Guid.genID());        setItemBiDefaultValue(zcPProMitemBi);        int rowNum = insertSub(biTablePanel, zcPProMitemBi);        biTablePanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    delBtn1.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        Integer[] checkedRows = deleteBiSub(biTablePanel);        // 从新计算采购预算        if (checkedRows.length > 0) {          self.caculateMoney(((BeanTableModel) biTablePanel.getTable().getModel()).getDataBeanList());        }      }    });    itemTabPane = new JTabbedPane();    itemTablePanel.init();    itemTablePanel.setPanelId(this.getClass().getName() + "_itemTablePanel");    itemTablePanel.getSearchBar().setVisible(false);    itemTablePanel.setTablePreferencesKey(this.getClass().getName() + "_itemTable");    itemTablePanel.getTable().setShowCheckedColumn(true);    itemTablePanel.getTable().getTableRowHeader().setPreferredSize(new Dimension(60, 0));    itemTabPane.addTab("计划明细", itemTablePanel);    // JGroupableTableHeader itemTableHeader =    // itemTablePanel.getTable().getTableHeader();    // itemTableHeader.addColumnGroup("采购预算资金", new String[] {    // "ZC_MER_PRICE", "ZC_FIELD_ZC_ITEM_SUM" });    bottomToolBar2 = new JFuncToolBar();    FuncButton addBtn11 = new SubaddButton(false);    JButton insertBtn11 = new SubinsertButton(false);    JButton delBtn11 = new SubdelButton(false);    bottomToolBar2.add(addBtn11);    bottomToolBar2.add(insertBtn11);    bottomToolBar2.add(delBtn11);    itemTablePanel.add(bottomToolBar2, BorderLayout.SOUTH);    addBtn11.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {                stopTableEditing();        ZcPProMitem zcPProMitem = new ZcPProMitem();        zcPProMitem.setTempId(Guid.genID());        setItemDefaultValue(zcPProMitem);                        addSub(itemTablePanel, zcPProMitem);      }    });    insertBtn11.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {                stopTableEditing();        ZcPProMitem zcPProMitem = new ZcPProMitem();        zcPProMitem.setTempId(Guid.genID());        setItemDefaultValue(zcPProMitem);        insertSub(itemTablePanel, zcPProMitem);      }    });    delBtn11.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {                stopTableEditing();        deleteSub(itemTablePanel);      }    });    biTabPane.setMinimumSize(new Dimension(240, 150));    itemTabPane.setMinimumSize(new Dimension(240, 300));    splitPane = new JSaveableSplitPane(JSplitPane.VERTICAL_SPLIT, biTabPane, itemTabPane);    splitPane.setDividerDefaultLocation(this.getClass().getName() + "_splitPane_dividerLocation", 300);    splitPane.setContinuousLayout(true);    splitPane.setOneTouchExpandable(true);    // 只显示向下的箭头    // splitPane.putClientProperty("toExpand", true);    splitPane.setDividerSize(10);    // splitPane.setDividerLocation(260);    splitPane.setBackground(self.getBackground());    return splitPane;  }  /*   *    * 创建成交信息面板   */  JBasePanel createSubChengJiaoPanel() {    this.chengJiaoPanel = new JBasePanel(this.getClass().getName() + "_chengjiao_panel");    ZcPProMake make = (ZcPProMake) this.listCursor.getCurrentObject();    if (make.getBaoJiaList() != null && make.getBaoJiaList().size() > 0) {      ZcPProMitemBaoJia bj = getChengJiaoBaoJia(make.getBaoJiaList());      JTabbedPane chengJiaoTabPanel = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);      assemJinJiaPanel(bj, chengJiaoTabPanel);      this.chengJiaoPanel.setLayout(new BorderLayout());      this.chengJiaoPanel.add(chengJiaoTabPanel, BorderLayout.CENTER);    }    assembJinJiaItemTabs("成交信息", "成交供应商的报价信息", this.chengJiaoPanel);    return this.chengJiaoPanel;  }  /*   *    * 获取成交的供应商，如果没有指定，默认获取最低价格,最早提交报价的供应商   */  public ZcPProMitemBaoJia getChengJiaoBaoJia(List jinJiaBaoJiaList) {    ZcPProMitemBaoJia minBaoJia = new ZcPProMitemBaoJia();    for (int i = 0; i < jinJiaBaoJiaList.size(); i++) {      ZcPProMitemBaoJia bj = (ZcPProMitemBaoJia) jinJiaBaoJiaList.get(i);      if (bj.isChengJiao()) {        return bj;      }      if (i == 0 || minBaoJia.getTotalPrice() == null) {        minBaoJia = bj;        continue;      }      // 比较价格      if (minBaoJia.getTotalPrice().compareTo(bj.getTotalPrice()) == 1) {        minBaoJia = bj;      } else if (minBaoJia.getTotalPrice().compareTo(bj.getTotalPrice()) == 0) {        // 比较日期        if (minBaoJia.getBaoJiaSubmitDate() != null && bj.getBaoJiaSubmitDate() != null        && minBaoJia.getBaoJiaSubmitDate().after(bj.getBaoJiaSubmitDate())) {          minBaoJia = bj;        }      }    }    return minBaoJia;  }  /*   *    * 创建竞价信息面板   */  JBasePanel createSubJinJiaPanel() {    this.itemTabPane.remove(this.jinJiaPanel);    this.jinJiaPanel = new JBasePanel(this.getClass().getName() + "_jingjia_panel");    ZcPProMake make = (ZcPProMake) this.listCursor.getCurrentObject();    if (make.getBaoJiaList() != null && make.getBaoJiaList().size() > 0) {      JTabbedPane jinjiaTabPanel = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);      for (int i = 0; i < make.getBaoJiaList().size(); i++) {        ZcPProMitemBaoJia bj = (ZcPProMitemBaoJia) make.getBaoJiaList().get(i);        assemJinJiaPanel(bj, jinjiaTabPanel);      }      this.jinJiaPanel.setLayout(new BorderLayout());      this.jinJiaPanel.add(jinjiaTabPanel, BorderLayout.CENTER);    }    assembJinJiaItemTabs("竞价明细", "供应商的报价信息", this.jinJiaPanel);    return this.jinJiaPanel;  }  public void assemJinJiaPanel(ZcPProMitemBaoJia bj, JTabbedPane jinjiaTabPanel) {    String suName = "";    if (bj.getSupplier() != null) {      suName = bj.getSupplier().getName();    }    ZcPProMakeJinJiaEditPanel jinJiaPanel = new ZcPProMakeJinJiaEditPanel(bj, this.self);    this.jinJiaPanelMap.put(bj, jinJiaPanel);    jinjiaTabPanel.addTab(ZcUtil.substring(suName, 16, "..."), null, jinJiaPanel, suName);  }  public JPanel assembBaoJiaTitlePanel(final ZcPProMitemBaoJia bj) {    // 计算总价    BigDecimal totalPrice = bj.getTotalPrice();    // 获取供应商的名称    String suName = "";    if (bj.getSupplier() != null)      suName = bj.getSupplier().getName();    JPanel titlePl = new JPanel();    JLabel gysLb = new JLabel("供应商");    JLabel bjLb = new JLabel("总价(元)");    JLabel riqiLb = new JLabel("提交时间");    JTextField gysTf = new JTextField();    gysTf.setPreferredSize(new Dimension(300, 23));    gysTf.setText(suName);    gysTf.setEditable(false);    MoneyField bjMf = new MoneyField();    bjMf.setPreferredSize(new Dimension(110, 23));    bjMf.setMoney(totalPrice);    bjMf.setEditable(false);    DateField riqiDf = new DateField(DateField.TimeTypeH24);    riqiDf.setEnabled(false);    riqiDf.setPreferredSize(new Dimension(110, 23));    riqiDf.setDate(bj.getBaoJiaSubmitDate());    String cjStr = "<html><body><font color='red'>成&nbsp;交</font></body></html>";    JCheckBox chengJiaChb = new JCheckBox(cjStr);    chengJiaChb.setSelected(bj.isChengJiao());    // this.chengJiaChkBoxList.add(chengJiaChb);    titlePl.setLayout(new GridBagLayout());    titlePl.add(gysLb, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 10, 5, 5), 0, 0));    titlePl.add(gysTf, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5),    0, 0));    titlePl.add(bjLb, new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));    titlePl.add(bjMf, new GridBagConstraints(3, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0,    0));    titlePl.add(riqiLb, new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));    titlePl.add(riqiDf, new GridBagConstraints(5, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5),    0, 0));    titlePl.add(chengJiaChb, new GridBagConstraints(6, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10,    5, 5), 0, 0));    return titlePl;  }  @Override  public void initToolBar(JFuncToolBar toolBar) {    toolBar.setModuleCode("ZC");    toolBar.setCompoId(getCompoId());    toolBar.add(addButton);    toolBar.add(saveButton);    toolBar.add(deleteButton);    toolBar.add(chengJiaoButton);    toolBar.add(jingJiaGongGaoButton);    toolBar.add(chengJiaoGongGaoButton);    toolBar.add(sendButton);    toolBar.add(suggestPassButton);//    toolBar.add(suggestPassCZButton);    toolBar.add(auditPassButton);    toolBar.add(callbackButton);    toolBar.add(unAuditButton);    toolBar.add(unTreadButton);    toolBar.add(cancelButton);// 撤销    toolBar.add(traceButton);    toolBar.add(previousButton);    toolBar.add(nextButton);    toolBar.add(printButton);    toolBar.add(confirmSupplyButton);// 确认供货    toolBar.add(printPreviewButton);    toolBar.add(printSettingButton);    toolBar.add(exitButton);    addButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 新增        doAdd();      }    });    saveButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 保存        doSave();      }    });    deleteButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 删除        doDelete();      }    });    chengJiaoButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 成交        doChengJiao();      }    });    sendButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 送审        doSend();      }    });    callbackButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 收回        doCallback();      }    });    suggestPassButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent arg0) {        stopTableEditing();        // 填写意见审核        doSuggestPass();      }    });    suggestPassCZButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent arg0) {        stopTableEditing();        doSuggestCZPass();      }    });    auditPassButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 审核        doAudit();      }    });    unAuditButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 销审        doUnaudit();      }    });    unTreadButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopTableEditing();        // 退回        doUntread();      }    });    traceButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 流程跟踪        doTrace();      }    });    previousButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 上一页        doPrevious();      }    });    nextButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 下一页        doNext();      }    });    exitButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 退出        doExit();      }    });    cancelButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doCancel();      }    });    printButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 打印        doPrint();      }    });    printPreviewButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrintPreview();      }    });    printSettingButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrintSetting();      }    });    jingJiaGongGaoButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doJingjiaGongGao();      }    });    chengJiaoGongGaoButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doChengjiaoGongGao();      }    });    confirmSupplyButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doConfirmSupply();      }    });  }  /*   *    * 成交   */  public void doChengJiao() {    ZcPProMake make = (ZcPProMake) this.listCursor.getCurrentObject();    if ("exec".equals(make.getZcMakeStatus())) {      int flag = JOptionPane.showConfirmDialog(this, "确定成交 ？", "确认操作", 0);      if (flag != 0) {        return;      } else {        if (make.getBaoJiaList() != null && make.getBaoJiaList().size() > 0) {          ZcPProMitemBaoJia bj = getChengJiaoBaoJia(make.getBaoJiaList());          ZcPProMitemBaoJia defaultBj = getDefaultBaoJia(make.getBaoJiaList());          if (!bj.equals(defaultBj)) {            int num = JOptionPane.showConfirmDialog(this, "成交供应商不是最低报价供应商，是否成交？", "成交确认", 0);            if (num == JOptionPane.YES_OPTION) {              setChengJiaostatus(bj);              make.setZcMakeStatus("jingjiaycj");// 设置成竞价结束--已成交              this.doSave();            }          } else {            setChengJiaostatus(defaultBj);            make.setZcMakeStatus("jingjiaycj");// 设置成竞价结束--已成交            this.doSave();          }        }      }    }  }  public void setChengJiaostatus(ZcPProMitemBaoJia selectedBj) {    ZcPProMake make = (ZcPProMake) this.listCursor.getCurrentObject();    List<ZcPProMitemBaoJia> bjLst = make.getBaoJiaList();    for (ZcPProMitemBaoJia bj : bjLst) {      if (!bj.equals(selectedBj)) {        bj.setChengJiao(false);      } else {        bj.setChengJiao(true);      }    }  }  /*   *    * 获取最低价格报价   */  public ZcPProMitemBaoJia getDefaultBaoJia(List jinJiaBaoJiaList) {    ZcPProMitemBaoJia minBaoJia = new ZcPProMitemBaoJia();    for (int i = 0; i < jinJiaBaoJiaList.size(); i++) {      ZcPProMitemBaoJia bj = (ZcPProMitemBaoJia) jinJiaBaoJiaList.get(i);      if (i == 0 || minBaoJia.getTotalPrice() == null) {        minBaoJia = bj;        continue;      }      // 比较价格      if (minBaoJia.getTotalPrice().compareTo(bj.getTotalPrice()) == 1) {        minBaoJia = bj;      } else if (minBaoJia.getTotalPrice().compareTo(bj.getTotalPrice()) == 0) {        // 比较日期        if (minBaoJia.getBaoJiaSubmitDate() != null && bj.getBaoJiaSubmitDate() != null        && minBaoJia.getBaoJiaSubmitDate().after(bj.getBaoJiaSubmitDate())) {          minBaoJia = bj;        }      }    }    return minBaoJia;  }  public void refreshAll(ZcPProMake afterSaveBill, boolean isRefreshButton) {    this.listCursor.setCurrentObject(afterSaveBill);    refreshData();    if (isRefreshButton) {      setButtonStatus(afterSaveBill, requestMeta, this.listCursor);    }  }  /*   *    * 新增   */  public void doAdd() {    if (this.doExit()) {      this.hasCreateJinjiaPanel = false;      this.listPanel.doAdd();    }  }  /*   *    * 流程跟踪   */  public void doTrace() {    ZcBaseBill bean = (ZcBaseBill) this.listCursor.getCurrentObject();    if (bean == null) {      return;    }    ZcUtil.showTraceDialog(bean, getCompoId());  }  public BaseRule getZcMakeCheckRule() {    return ZcMakeCheckRule.getInstance();  }  /*   *    * 送审   */  public void doSend() {    boolean success = true;    ZcPProMake afterSaveBill = null;    String errorInfo = "";    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    if (listPanel.checkBeforeSave(make, self)) {      return;    }    int num = JOptionPane.YES_OPTION;    if (num == JOptionPane.YES_OPTION) {      try {        requestMeta.setFuncId(this.sendButton.getFuncId());                //这一段注释掉，不检查//        /**//         * 验证指标预算金额//         *///        if (isUseBi) {//          if (this.listPanel.chackBiMoney(make)) {//            return;//          }////        }        make.setAuditorId(WorkEnv.getInstance().getCurrUserId());        afterSaveBill = this.listPanel.getZcPProMakeServiceDelegate()          .newCommitFN(make, ZcUtil.useBudget(), WorkEnv.getInstance().getWebRoot(), requestMeta);      } catch (Exception ex) {        errorInfo += ex.getMessage();        logger.error(ex.getMessage(), ex);        success = false;        UIUtilities.showStaickTraceDialog(ex, this, "错误", ex.getMessage());      }      if (success) {        this.refreshAll(afterSaveBill, true);        JOptionPane.showMessageDialog(this, "送审成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.listPanel.refreshCurrentTabData();      }    }  }  public void doCancel() {    boolean success = true;    requestMeta.setFuncId(this.cancelButton.getFuncId());    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    int num = JOptionPane.showConfirmDialog(this, "确实要作废计划？");    if (num == JOptionPane.YES_OPTION) {      try {        make.setZcMakeStatus("cancel");        this.getZcPProMakeServiceDelegate().CancelMakeFN(make, requestMeta);      } catch (Exception ex) {        logger.error(ex.getMessage(), ex);        success = false;        UIUtilities.showStaickTraceDialog(ex, this, "错误", ex.getMessage());      }      if (success) {        this.refreshAll(make, true);        JOptionPane.showMessageDialog(this, "作废成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.listPanel.refreshCurrentTabData();      }    }  }  /*   *    * 收回   */  public void doCallback() {    boolean success = true;    ZcPProMake afterSaveBill = null;    String errorInfo = "";    try {      requestMeta.setFuncId(this.callbackButton.getFuncId());      ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      make.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveBill = listPanel.getZcPProMakeServiceDelegate().callbackFN(make, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "收回成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "收回失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*   *    * 填写意见审核   */  public void doSuggestPass() {    String errorInfo = "";    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    if (listPanel.checkBeforeSave(make, self)) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    int num = JOptionPane.YES_OPTION;    BaseRule rule = getZcMakeCheckRule();    Map parameter = new HashMap();    parameter.put("data", make);    // 填报提示信息    Map resMap = rule.check(parameter);    String resInfo = (String) resMap.get("resInfo");    if (resInfo != null && resInfo.length() > 0) {      num = JOptionPane.showConfirmDialog(this, resInfo, "提示", 0);    }    if (num == JOptionPane.YES_OPTION) {      GkCommentDialog commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),      ModalityType.APPLICATION_MODAL);      if (commentDialog.cancel) {        return;      }      boolean success = true;      ZcPProMake afterSaveBill = null;      try {        requestMeta.setFuncId(this.suggestPassButton.getFuncId());        make.setComment(commentDialog.getComment());        make.setZcAttr1("N");        make.setAuditorId(WorkEnv.getInstance().getCurrUserId());        afterSaveBill = listPanel.getZcPProMakeServiceDelegate().auditFN(make, requestMeta);      } catch (Exception e) {        success = false;        logger.error(e.getMessage(), e);        errorInfo += e.getMessage();      }      if (success) {        this.refreshAll(afterSaveBill, true);        JOptionPane.showMessageDialog(this, "审核成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.listPanel.refreshCurrentTabData();        // unAuditButton.setVisible(true);      } else {        JOptionPane.showMessageDialog(this, "审核失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      }    }  }  /*   *    * 填写意见审核   */  public void doSuggestCZPass() {    String errorInfo = "";    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    if (listPanel.checkBeforeSave(make, self)) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    int num = JOptionPane.YES_OPTION;    BaseRule rule = getZcMakeCheckRule();    Map parameter = new HashMap();    parameter.put("data", make);    // 填报提示信息    Map resMap = rule.check(parameter);    String resInfo = (String) resMap.get("resInfo");    if (resInfo != null && resInfo.length() > 0) {      num = JOptionPane.showConfirmDialog(this, resInfo, "提示", 0);    }    if (num == JOptionPane.YES_OPTION) {      GkCommentDialog commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),      ModalityType.APPLICATION_MODAL);      if (commentDialog.cancel) {        return;      }      boolean success = true;      ZcPProMake afterSaveBill = null;      try {        requestMeta.setFuncId(this.suggestPassButton.getFuncId());        make.setComment(commentDialog.getComment());        make.setAuditorId(WorkEnv.getInstance().getCurrUserId());        make.setZcAttr1("Y");        afterSaveBill = listPanel.getZcPProMakeServiceDelegate().auditFN(make, requestMeta);      } catch (Exception e) {        success = false;        logger.error(e.getMessage(), e);        errorInfo += e.getMessage();      }      if (success) {        this.refreshAll(afterSaveBill, true);        JOptionPane.showMessageDialog(this, "审核成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.listPanel.refreshCurrentTabData();        // unAuditButton.setVisible(true);//如果审核通过，将销审按钮设置为可见      } else {        JOptionPane.showMessageDialog(this, "审核失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      }    }  }  /*   *    * 审核   */  public void doAudit() {    String errorInfo = "";    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    if (listPanel.checkBeforeSave(make, self)) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    int num = JOptionPane.YES_OPTION;    BaseRule rule = getZcMakeCheckRule();    Map parameter = new HashMap();    parameter.put("data", make);    // 填报提示信息    Map resMap = rule.check(parameter);    String resInfo = (String) resMap.get("resInfo");    if (resInfo != null && resInfo.length() > 0) {      num = JOptionPane.showConfirmDialog(this, resInfo, "提示", 0);    }    if (num == JOptionPane.YES_OPTION) {      boolean success = true;      ZcPProMake afterSaveBill = null;      try {        requestMeta.setFuncId(this.auditPassButton.getFuncId());        make.setAuditorId(WorkEnv.getInstance().getCurrUserId());        afterSaveBill = listPanel.getZcPProMakeServiceDelegate().auditFN(make, requestMeta);      } catch (Exception e) {        success = false;        logger.error(e.getMessage(), e);        errorInfo += e.getMessage();      }      if (success) {        this.refreshAll(afterSaveBill, true);        JOptionPane.showMessageDialog(this, "审核成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.listPanel.refreshCurrentTabData();      } else {        JOptionPane.showMessageDialog(this, "审核失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      }    }  }  /*   *    * 销审   */  public void doUnaudit() {    boolean success = true;    ZcPProMake afterSaveBill = null;    String errorInfo = "";    int i = JOptionPane.showConfirmDialog(this, "是否确定消审？", "确认", JOptionPane.INFORMATION_MESSAGE);    if (i != 0) {      return;    }    try {      requestMeta.setFuncId(unAuditButton.getFuncId());      ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      make.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveBill = listPanel.getZcPProMakeServiceDelegate().unAuditFN(make, requestMeta);// add shijia 20111031    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "销审成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      unAuditButton.setVisible(false);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "销审失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*   *    * 退回   */  public void doUntread() {    GkCommentUntreadDialog commentDialog = new GkCommentUntreadDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),    ModalityType.APPLICATION_MODAL);    if (commentDialog.cancel) {      return;    }    boolean success = true;    ZcPProMake afterSaveBill = null;    String errorInfo = "";    try {      requestMeta.setFuncId(unTreadButton.getFuncId());      ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      make.setAuditorId(WorkEnv.getInstance().getCurrUserId());      make.setComment(commentDialog.getComment());      afterSaveBill = listPanel.getZcPProMakeServiceDelegate().untreadFN(make, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "退回成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "退回失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  public void doPrevious() {    if (isDataChanged()) {      int num = JOptionPane.showConfirmDialog(this, "当前页面数据已修改，是否要保存", "保存确认", 0);      if (num == JOptionPane.YES_OPTION) {        if (!doSave()) {          return;        }      } else {        listCursor.setCurrentObject(oldZcPProMake);      }    }    listCursor.previous();    this.hasCreateJinjiaPanel = false;    refreshData();  }  public void doNext() {    if (isDataChanged()) {      int num = JOptionPane.showConfirmDialog(this, "当前页面数据已修改，是否要保存", "保存确认", 0);      if (num == JOptionPane.YES_OPTION) {        if (!doSave()) {          return;        }      } else {        listCursor.setCurrentObject(oldZcPProMake);      }    }    listCursor.next();    this.hasCreateJinjiaPanel = false;    refreshData();  }  public boolean doExit() {    // itemTablePanel.getTable().getDisplayValueAt(0, 3);//    if (isDataChanged()) {////      int num = JOptionPane.showConfirmDialog(this, "当前页面数据已修改，是否要保存", "保存确认", 0);////      if (num == JOptionPane.YES_OPTION) {////        if (!doSave()) {////          return false;////        }////      }////    }    this.parent.dispose();    return true;  }  /**   *    * 保存前校验   *    * @param cpApply   *    * @return   */  public boolean doSave() {    if (!isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据没有发生改变，不用保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return true;    }    boolean success = true;    String errorInfo = "";    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    if (listPanel.checkBeforeSave(make, self)) {      return false;    }    try {      requestMeta.setFuncId(saveButton.getFuncId());      ZcPProMake inData = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      ZcPProMake zcPProMake = this.listPanel.getZcPProMakeServiceDelegate().updateZcPProMakeFN(inData, ZcUtil.useBudget(),        WorkEnv.getInstance().getWebRoot(), this.requestMeta);      listCursor.setCurrentObject(zcPProMake);    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      JOptionPane.showMessageDialog(this, "保存成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      refreshData();      this.listPanel.refreshCurrentTabData();      sendButton.setEnabled(true);      deleteButton.setEnabled(true);    } else {      JOptionPane.showMessageDialog(this, "保存失败 ！\n" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      return false;    }    return true;  }  protected void doDelete() {    int num = JOptionPane.showConfirmDialog(this, "是否删除当前单据", "删除确认", 0);    if (num == JOptionPane.YES_OPTION) {      boolean success = true;      ZcPProMake zcPProMake = null;      String errorInfo = "";      try {        requestMeta.setFuncId(deleteButton.getFuncId());        zcPProMake = (ZcPProMake) this.listCursor.getCurrentObject();        // if (!"0".equals(zcPProMake.getZcMakeStatus()))        //        // JOptionPane.showMessageDialog(this, "非编辑状态单据，不可以删除！", "提示",        // JOptionPane.ERROR_MESSAGE);        this.listPanel.getZcPProMakeServiceDelegate().deleteByPrimaryKeyFN(zcPProMake.getZcMakeCode(), ZcUtil.useBudget(),          WorkEnv.getInstance().getWebRoot(), this.requestMeta);      } catch (Exception e) {        logger.error(e.getMessage(), e);        success = false;        errorInfo += e.getMessage();      }      if (success) {        this.listCursor.removeCurrentObject();        JOptionPane.showMessageDialog(this, "删除成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.refreshData();        this.listPanel.refreshCurrentTabData();        // sendButton.setEnabled(false);        if (this.listCursor.isEmpty()) {          deleteButton.setEnabled(false);        }      } else {        JOptionPane.showMessageDialog(this, "保存失败 ！\n" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      }    }  }  public void stopTableEditing() {    JPageableFixedTable biTable = this.biTablePanel.getTable();    if (biTable.isEditing()) {      biTable.getCellEditor().stopCellEditing();    }    JPageableFixedTable itemTable = this.itemTablePanel.getTable();    if (itemTable.isEditing()) {      itemTable.getCellEditor().stopCellEditing();    }  }  public boolean isDataChanged() {    stopTableEditing();    return !DigestUtil.digest(oldZcPProMake).equals(DigestUtil.digest(listCursor.getCurrentObject()));  }  protected IZcPProMakeServiceDelegate getZcPProMakeServiceDelegate() {    if (listPanel == null) {      IZcPProMakeServiceDelegate ZcPProMakeServiceDelegate = (IZcPProMakeServiceDelegate) ServiceFactory.create(IZcPProMakeServiceDelegate.class,      "zcPProMakeServiceDelegate");      return ZcPProMakeServiceDelegate;    }    return this.listPanel.getZcPProMakeServiceDelegate();  }  public void setDeftValue(ZcPProMake zcPProMake) {    zcPProMake.setZcPitemOpiway(ZcSettingConstants.ZC_CGFS_GKZB);    zcPProMake.setZcPifuCgfs(ZcSettingConstants.ZC_CGFS_GKZB);    zcPProMake.setZcMakeStatus(ZcSettingConstants.WF_STATUS_DRAFT);    zcPProMake.setZcIsImp("N");// hjh updated 2011-05-05 11:50        zcPProMake.setAgency(AsOptionMeta.getOptVal(ZcElementConstants.OPT_ZC_CGZX_CODE));        zcPProMake.setAgencyName(AsOptionMeta.getOptVal(ZcElementConstants.OPT_ZC_CGZX_NAME));    zcPProMake.setZcMakeSequence(ZcSettingConstants.ZC_ZZXS_ZFJZCG);    zcPProMake.setZcFukuanType(ZcSettingConstants.ZC_CGLX_XMCG);// 项目采购wangwei updated 2011-04-07 23:00    zcPProMake.setZcYepFlag("00");//项目处理标记    zcPProMake.setZcIsBudget("N");  }  public List getItemInfo() {    return ZcPProMakeToTableModelConverter.itemXyInfo;  }  protected void refreshData() {    ZcPProMake zcPProMake = (ZcPProMake) listCursor.getCurrentObject();    boolean isNew;    if (zcPProMake != null) {      isNew = false;      zcPProMake = getZcPProMakeServiceDelegate().selectByPrimaryKey(zcPProMake.getZcMakeCode(), this.requestMeta);      List biList = getZcPProMakeServiceDelegate().getZcPProMitemBi(zcPProMake.getZcMakeCode(), ZcUtil.useBudget(), requestMeta);      zcPProMake.setBiList(biList);      listCursor.setCurrentObject(zcPProMake);      if (biList != null && biList.size() > 0) {        if (ZcUtil.useBudget()) {          String biNoStrs = "";          for (int i = 0; i < biList.size(); i++) {            ZcPProMitemBi bi = (ZcPProMitemBi) biList.get(i);            if (bi.getZcBiNo() == null || "".equals(bi.getZcBiNo())) {              bi.setZcBiDoSum(null);              continue;            }            if (biNoStrs.length() > 0) {              biNoStrs = biNoStrs + ",'" + bi.getZcBiNo() + "'";            } else {              biNoStrs = "'" + bi.getZcBiNo() + "'";            }          }          getDto.setZcText3(biNoStrs);        }      }      if (ZcUtil.useBudget()) {        getDto.setZcMakeCode(zcPProMake.getZcMakeCode());      }    } else {      deleteButton.setEnabled(false);      isNew = true;      zcPProMake = new ZcPProMake();      setDeftValue(zcPProMake);      zcPProMake.setCoCode(this.requestMeta.getSvCoCode());      zcPProMake.setOrgCode(WorkEnv.getInstance().getCurrCompany().getForgCode());      zcPProMake.setNd(this.requestMeta.getSvNd());      zcPProMake.setBiList(new ArrayList());      zcPProMake.setItemList(new ArrayList());      // 新增数据默认插入一行      ZcPProMitem item = new ZcPProMitem();      setItemDefaultValue(item);      zcPProMake.getItemList().add(item);      ZcPProMitemBi bi = new ZcPProMitemBi();      setItemBiDefaultValue(bi);      zcPProMake.getBiList().add(bi);      listCursor.getDataList().add(zcPProMake);      listCursor.setCurrentObject(zcPProMake);      initOrg(zcPProMake);    }    if (ZcUtil.useBudget()) {      getDto.setNd(requestMeta.getSvNd());      getDto.setZcText2("1");//对应sql语句里是可用指标金额>0      getDto.setCoCode(zcPProMake.getCoCode() != null ? zcPProMake.getCoCode() : requestMeta.getSvCoCode());    }    this.setEditingObject(zcPProMake);    itemTablePanel.setTableModel(new ZcPProMakeToTableModelConverter().convertSubItemTableData(zcPProMake.getItemList(), getItemInfo(),      wfCanEditFieldMap));    if(ZcUtil.useBudget()){    biTablePanel.setTableModel(ZcPProMakeToTableModelConverter.convertSubBiTableData(zcPProMake.getBiList(), wfCanEditFieldMap));    }else{      biTablePanel.setTableModel(ZcPProMakeToTableModelConverter.convertSubBiTableDataWithOutBudget(zcPProMake.getBiList(), wfCanEditFieldMap));    }    // 刷新竞价信息和成交信息    refreshJinJiaChengJiao();    // 翻译从表表头列    ZcUtil.translateColName(itemTablePanel.getTable(), getItemInfo());        if(ZcUtil.useBudget()){      ZcUtil.translateColName(biTablePanel.getTable(), ZcPProMakeToTableModelConverter.biInfo);    }else{      ZcUtil.translateColName(biTablePanel.getTable(), ZcPProMakeToTableModelConverter.biInfo2);    }    // 设置从表列类型    setTableBiEditor(biTablePanel.getTable());    setTableItemEditor(itemTablePanel.getTable());    // 设置从表监听    addBiTableLisenter(biTablePanel.getTable());    addItemTableLisenter(itemTablePanel.getTable());    setOldObject();    // 根据工作流模版设置字段是否可编辑    updateWFEditorEditable(zcPProMake, requestMeta);    // 根据工作流模版设置功能按钮是否可用    setButtonStatus(zcPProMake, requestMeta, this.listCursor);    this.fitTable();    // 草稿状态设置【批复采购方式】只读    if ("0".equals(zcPProMake.getZcMakeStatus())) {      if (zcPifuCgfs != null) {        zcPifuCgfs.setEnabled(true);      }    }    if (isNew) {      biTablePanel.getTable().setRowSelectionInterval(0, 0);      itemTablePanel.getTable().setRowSelectionInterval(0, 0);    }    if (zcPProMake.getZcMakeStatus().equals("0") && zcPProMake.getProcessInstId() != null && zcPProMake.getProcessInstId().longValue() > 0) {      sendButton.setEnabled(true);      deleteButton.setEnabled(true);    }    if (zcPProMake.getZcMakeStatus().equals("0") && zcPProMake.getProcessInstId() == null) {      deleteButton.setEnabled(false);      sendButton.setEnabled(true);    }    //    if (zcPProMake.getZcMakeStatus().equals("0")) {    //    //      updateWFSubTableEditable(true);    //    //    } else {    //    //      updateWFSubTableEditable(false);    //    //    }    //    if ("40".equals(zcPProMake.getZcMakeStatus()) && this.suggestPassButton.isVisible()) {    //      setWFSubTableEditable(this.itemTablePanel, true);    //    }    biTabPane.repaint();    itemTabPane.repaint();  }  /*   *    * 刷新竞价信息和汇总信息   */  public void refreshJinJiaChengJiao() {    ZcPProMake make = (ZcPProMake) listCursor.getCurrentObject();    // 非协议竞价采购，移除竞价信息面板和成交信息面板,G03表示电子竞价    if (!ZcPProMake.CAIGOU_TYPE_XIEYI.equals(make.getZcFukuanType()) && !"G03".equals(make.getZcFukuanType())) {      this.itemTabPane.remove(this.jinJiaSummaryTablePanel);      this.itemTabPane.remove(this.jinJiaPanel);      return;    }    // 竞价截止时间未到，不显示供应商的报价信息    if (!isJinJiaEndTime())      return;    createSubJinJiaSummaryPanel();    createSubJinJiaPanel();    /*     * if (!this.hasCreateJinjiaPanel) {     *      * //创建汇总列表面板     *      * //创建竞价信息面板     *      * this.hasCreateJinjiaPanel = true;     *      * } else {     *      * //当保存后，重新获取了对象，需要重新更新竞价面板的数据对象和竞价汇总表的model的数据对象     *      *      *      * //更新竞价汇总表的model的数据对象     *      * refreshSummaryTable();     *      *      *      * //重新更新竞价面板的数据对象     *      * refreshJinJiaPanelData();     *      * }     */    // 默认价格最低的供应商为中标供应商    if (make.getBaoJiaList().size() > 0) {      ZcPProMitemBaoJia baojia = (ZcPProMitemBaoJia) make.getBaoJiaList().get(0);      baojia.setChengJiaoStatus("Y");    }  }  public void refreshSummaryTable() {    ZcPProMake make = (ZcPProMake) listCursor.getCurrentObject();    BeanTableModel model = (BeanTableModel) this.jinJiaSummaryTablePanel.getTable().getModel();    model.setDataBean(make.getBaoJiaList(), ZcPProMakeToTableModelConverter.createJinJiaSummaryPairs());    setJinJiaSummaryTablePropety();  }  /*   *    * 创建汇总列表面板   */  public void createSubJinJiaSummaryPanel() {    this.itemTabPane.remove(this.jinJiaSummaryTablePanel);    jinJiaSummaryTablePanel.init();    itemTablePanel.setPanelId(this.getClass().getName() + "_jinjiasumarry_Table");    jinJiaSummaryTablePanel.getSearchBar().setVisible(false);    jinJiaSummaryTablePanel.setTablePreferencesKey(this.getClass().getName() + "_jinjiasumarry_Table");    jinJiaSummaryTablePanel.getTable().setShowCheckedColumn(true);    jinJiaSummaryTablePanel.getTable().getTableRowHeader().setPreferredSize(new Dimension(60, 0));    ZcPProMake make = (ZcPProMake) this.listCursor.getCurrentObject();    jinJiaSummaryTablePanel.setTableModel(ZcPProMakeToTableModelConverter.convertSubJinJiaTableData(make.getBaoJiaList()));    setJinJiaSummaryTablePropety();    this.itemTabPane.addTab("竞价汇总", null, jinJiaSummaryTablePanel, "竞价汇总");  }  public void setJinJiaSummaryTablePropety() {    ZcUtil.translateColName(jinJiaSummaryTablePanel.getTable(), "ZC_EB_");    SwingUtil.setTableCellEditor(jinJiaSummaryTablePanel.getTable(), "CHENG_JIAO_STATUS", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(jinJiaSummaryTablePanel.getTable(), "CHENG_JIAO_STATUS", new AsValCellRenderer("VS_Y/N"));    addSummaryTableLisenter(jinJiaSummaryTablePanel.getTable());  }  public void addSummaryTableLisenter(final JPageableFixedTable table) {    final BeanTableModel model = (BeanTableModel) table.getModel();    model.addTableModelListener(new TableModelListener() {      public void tableChanged(TableModelEvent e) {        if (e.getColumn() >= 0 && "CHENG_JIAO_STATUS".equals(model.getColumnIdentifier(e.getColumn()))) {          int k = table.getSelectedRow();          if (k < 0)            return;          ZcPProMitemBaoJia item = (ZcPProMitemBaoJia) model.getBean(table.convertRowIndexToModel(k));          summaryTableChanged(item);          model.fireTableRowsUpdated(k, k);        }      }    });  }  /*   *    * 刷新竞价汇总信息面板   */  public void summaryTableChanged(ZcPProMitemBaoJia chengJiao) {    ZcPProMake make = (ZcPProMake) listCursor.getCurrentObject();    // 界面第一次初始化话时获取成交供应商    if (chengJiao == null) {      chengJiao = getChengJiaoBaoJia(make.getBaoJiaList());    }    if (this.jinJiaPanelMap.get(chengJiao) != null) {      for (int i = 0; i < make.getBaoJiaList().size(); i++) {        ZcPProMitemBaoJia baojia = (ZcPProMitemBaoJia) make.getBaoJiaList().get(i);        if (baojia.equals(chengJiao)) {          baojia.setChengJiao(chengJiao.isChengJiao());        } else {          baojia.setChengJiao(false);        }      }      this.currentChengJiao = chengJiao;      refreshJinJiaPanelData();    }  }  public void checkInModel(String title) {    BeanTableModel model = (BeanTableModel) this.jinJiaSummaryTablePanel.getTable().getModel();    List<ZcPProMitemBaoJia> lst = model.getDataBeanList();  }  public void checkInMake(String title) {    ZcPProMake make = (ZcPProMake) listCursor.getCurrentObject();    List<ZcPProMitemBaoJia> lst = make.getBaoJiaList();  }  /*   *    * 刷新竞价信息面板的数据   */  public void refreshJinJiaPanelData() {    Iterator<ZcPProMitemBaoJia> keys = this.jinJiaPanelMap.keySet().iterator();    while (keys.hasNext()) {      ZcPProMitemBaoJia baoJia = keys.next();      ZcPProMakeJinJiaEditPanel jinJiaPanel = this.jinJiaPanelMap.get(baoJia);      jinJiaPanel.setEditingObject(baoJia);      jinJiaPanel.refreshData();      this.jinJiaPanelMap.put(baoJia, jinJiaPanel);    }  }  /*   *    * 根据需要组装竞价相关的tab页签   */  public void assembJinJiaItemTabs(String title, String tip, JPanel contentPanel) {    for (int i = 0; i < this.itemTabPane.getTabCount(); i++) {      if (this.itemTabPane.getComponentAt(i).equals(contentPanel)) {        return;      }    }    this.itemTabPane.addTab(title, null, contentPanel, tip);  }  /*   *    * 判断是否竞价截止时间是否到达   */  public boolean isJinJiaEndTime() {    ZcPProMake zcPProMake = (ZcPProMake) listCursor.getCurrentObject();    if (zcPProMake.getZcXieYiEndDate() == null) {      return false;    }    if (this.requestMeta.getSysDate().after(zcPProMake.getZcXieYiEndDate())) {      return true;    }    return false;  }  public void addBiTableLisenter(JPageableFixedTable table) {    final JPageableFixedTable mytable = table;    final BeanTableModel model = (BeanTableModel) table.getModel();    model.addTableModelListener(new TableModelListener() {      public void tableChanged(TableModelEvent e) {        if (e.getColumn() >= 0 && "ZC_BI_JHUA_SUM".equals(model.getColumnIdentifier(e.getColumn()))) {          self.caculateMoney(model.getDataBeanList());        }        // if (zcPProMake.getZcMakeStatus() == "todo") {        // mytable.setEnabled(false);        // }      }    });    // System.out.println("this is ?...........");  }  public void addItemTableLisenter(final JPageableFixedTable table) {    final BeanTableModel model = (BeanTableModel) table.getModel();    model.addTableModelListener(new TableModelListener() {      public void tableChanged(TableModelEvent e) {        if (e.getType() == TableModelEvent.UPDATE) {          if (e.getColumn() >= 0          && ("ZC_P_PROMAKE_PRICE".equals(model.getColumnIdentifier(e.getColumn()))          || "ZC_FIELD_ZC_CAIG_NUM".equals(model.getColumnIdentifier(e.getColumn())) || "ZC_MER_PRICE".equals(model.getColumnIdentifier(e          .getColumn())))) {            int k = table.getSelectedRow();            if (k < 0)              return;            ZcPProMitem item = (ZcPProMitem) model.getBean(table.convertRowIndexToModel(k));            BigDecimal caigNum = item.getZcCaigNum() == null ? BigDecimal.ZERO : item.getZcCaigNum();            BigDecimal merPrice = item.getZcMerPrice() == null ? new BigDecimal(0) : item.getZcMerPrice();            if (caigNum != null && merPrice != null) {              item.setZcItemSum(caigNum.multiply(merPrice));              model.fireTableRowsUpdated(k, k);            }            // 在此判断如果资金构成列表中，预算金额之和为0则，设置采购预算为当前计划明细 总价的 合计 wangwei            // update start            ZcPProMake beanData = (ZcPProMake) self.listCursor.getCurrentObject();            List<ZcPProMitemBi> bis = beanData.getBiList();            BigDecimal sum = BigDecimal.ZERO;            if (bis != null) {              for (ZcPProMitemBi bi : bis) {                sum = sum.add((BigDecimal) ObjectUtils.defaultIfNull(bi.getZcBiJhuaSum(), new BigDecimal("0.00")));              }            }            if (sum.compareTo(BigDecimal.ZERO) <= 0) {              List<ZcPProMitem> its = beanData.getItemList();              BigDecimal sumi = BigDecimal.ZERO;              if (its != null) {                for (ZcPProMitem zcPProMitem : its) {                  sumi = sumi.add((BigDecimal) ObjectUtils.defaultIfNull(zcPProMitem.getZcItemSum(), new BigDecimal("0.00")));                }              }              // 设置采购预算金额              // beanData.setZcMoneyBiSum(sumi);              beanData.getBiList().size();              self.setEditingObject(beanData);              if ("N".equals(beanData.getZcIsImp())) {                if (zcImpFile != null)                  zcImpFile.setEnabled(false);              }            }            // wangwei updated end          }        }      }    });  }  protected void caculateMoney(List<ZcPProMitemBi> biList) {    BigDecimal sum = BigDecimal.ZERO;    for (ZcPProMitemBi bi : biList) {      sum = sum.add((BigDecimal) ObjectUtils.defaultIfNull(bi.getZcBiJhuaSum(), new BigDecimal("0.00")));    }    ZcPProMake beanData = (ZcPProMake) this.listCursor.getCurrentObject();    if (sum.compareTo(beanData.getZcMoneyBiSum()) != 0) {      beanData.setZcMoneyBiSum(sum);      this.setEditingObject(beanData);    }  }  public void setTableBiEditor(JPageableFixedTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    if (ZcUtil.useBudget()) {      String colNames[] = { "指标余额表ID", "指标来源", "发文文号", "资金性质","采购项目", "功能分类", "经济分类","是否监督使用","是否政府采购","指标总金额","指标可用金额" };      ZcBudgetHandler budgetHandler = new ZcBudgetHandler(colNames, biTablePanel, this, listCursor, getDto);      ForeignEntityFieldCellEditor suEditor = new ForeignEntityFieldCellEditor("VwBudgetGp.getVwBudgetGp", getDto, 20, budgetHandler, colNames,        "资金构成", "sumId");      SwingUtil.setTableCellEditor(table, "ZC_BI_NO", suEditor);      SwingUtil.setTableCellEditor(table, "ZC_BI_SUM", new MoneyCellEditor(false));      SwingUtil.setTableCellRenderer(table, "ZC_BI_SUM", new NumberCellRenderer());      SwingUtil.setTableCellEditor(table, "ZC_BI_DO_SUM", new MoneyCellEditor(false));      SwingUtil.setTableCellRenderer(table, "ZC_BI_DO_SUM", new NumberCellRenderer());      SwingUtil.setTableCellEditor(table, "ZC_BI_JHUA_SUM", new MoneyCellEditor(false));      SwingUtil.setTableCellRenderer(table, "ZC_BI_JHUA_SUM", new NumberCellRenderer());      SwingUtil.setTableCellEditor(table, "ZC_BI_YJBA_SUM", new MoneyCellEditor(false));      SwingUtil.setTableCellRenderer(table, "ZC_BI_YJBA_SUM", new NumberCellRenderer());    }else{    SwingUtil.setTableCellEditor(table, "ZC_BI_JHUA_SUM", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "ZC_BI_JHUA_SUM", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "ZC_BI_YJBA_SUM", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "ZC_BI_YJBA_SUM", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, FIELD_TRANS_FUND_CODE, new AsValComboBoxCellEditor("ZC_VS_FUND_NAME"));    SwingUtil.setTableCellRenderer(table, ZcElementConstants.FIELD_TRANS_FUND_CODE, new AsValCellRenderer("ZC_VS_FUND_NAME"));    SwingUtil.setTableCellEditor(table, FIELD_TRANS_ORIGIN_CODE, new AsValComboBoxCellEditor("ZC_VS_ORIGIN_NAME"));    SwingUtil.setTableCellRenderer(table, ZcElementConstants.FIELD_TRANS_ORIGIN_CODE, new AsValCellRenderer("ZC_VS_ORIGIN_NAME"));    SwingUtil.setTableCellEditor(table, ZcElementConstants.FIELD_TRANS_PAYTYPE_CODE, new AsValComboBoxCellEditor("ZC_VS_PAYTYPE_NAME"));    SwingUtil.setTableCellRenderer(table, ZcElementConstants.FIELD_TRANS_PAYTYPE_CODE, new AsValCellRenderer("ZC_VS_PAYTYPE_NAME"));    SwingUtil.setTableCellEditor(table, "ZC_FUND_FILE", new FileCellEditor("zcFundFileBlobid", (BeanTableModel) table.getModel()));//    String status = ((ZcPProMake) listCursor.getCurrentObject()).getZcMakeStatus();////    if (!"exec".equals(status) && !"yjz".equals(status)) {////      table.getTableHeader().getColumnModel().removeColumn(table.getColumn("ZC_BI_YJBA_SUM"));////    }    }  }  public void setTableItemEditor(JTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    SwingUtil.setTableCellEditor(table, FIELD_TRANS_ZC_PITEM_ARR_DATE, new DateCellEditor());    SwingUtil.setTableCellRenderer(table, FIELD_TRANS_ZC_PITEM_ARR_DATE, new DateCellRenderer());    SwingUtil.setTableCellEditor(table, FIELD_TRANS_ZC_CATALOGUE_CODE, new ZcBCatalogueCellEditor(false, false));    SwingUtil.setTableCellEditor(table, ZcElementConstants.FIELD_TRANS_ZC_PITEM_ATTACH, new FileCellEditor("zcPitemAttachBlobid",    (BeanTableModel) table.getModel()));    // SwingUtil.setTableCellEditor(table, "ZC_FIELD_ZC_ITEM_SUM", new    // TextCellEditor());    MoneyCellEditor mce = new MoneyCellEditor(false);    mce.getField().setEnabled(false);    SwingUtil.setTableCellEditor(table, "ZC_FIELD_ZC_ITEM_SUM", mce);    SwingUtil.setTableCellRenderer(table, "ZC_FIELD_ZC_ITEM_SUM", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "BUDGET_BI_MONEY", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "BUDGET_BI_MONEY", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "BUDGET_OTHER_MONEY", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "BUDGET_OTHER_MONEY", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "ZC_MER_PRICE", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "ZC_MER_PRICE", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "ZC_FIELD_ZC_CAIG_NUM", new MoneyCellEditor(false));    String[] brandColumNames = { "品牌编号", "品牌名称", "商品数量" };    ZcEbBrandHandler brandHandler = new ZcEbBrandHandler(brandColumNames);    this.brandDto = new ElementConditionDto();    ForeignEntityFieldCellEditor packEditor = new ForeignEntityFieldCellEditor("ZcBrand.getBrandsForXieYi", this.brandDto, 20, brandHandler,    brandColumNames, "品牌", "zcBraName");    SwingUtil.setTableCellEditor(table, "ZC_BRA_NAME", packEditor);    String[] merColumNames = { "商品", "品牌", "规格", "价格" };    ZcEbMerHandler merHandler = new ZcEbMerHandler(merColumNames);    this.merDto = new ElementConditionDto();    ForeignEntityFieldCellEditor merEditor = new ForeignEntityFieldCellEditor("ZcBMerchandise.getMerchandise2", this.merDto, 20, merHandler,    merColumNames, "商品", "zcMerName");    SwingUtil.setTableCellEditor(table, "ZC_MER_NAME", merEditor);    String[] suColumNames = { "名称", "联系人", "电话", "地址" };    ZcEbSupplierHandler suHandler = new ZcEbSupplierHandler(suColumNames);    this.merDto = new ElementConditionDto();    ForeignEntityFieldCellEditor suEditor = new ForeignEntityFieldCellEditor("ZcEbSupplier.getZcEbSupplierByMer", this.merDto, 20, suHandler,    suColumNames, "供应商", "name");    SwingUtil.setTableCellEditor(table, "ZC_SU_NAME", suEditor);  }  public void setOldObject() {    oldZcPProMake = (ZcPProMake) ObjectUtil.deepCopy(listCursor.getCurrentObject());  }  public class ZcAgeyFnHandler implements IForeignEntityHandler {    public String columNames[];    public ZcAgeyFnHandler(String columNames[]) {      this.columNames = columNames;    }    public void excute(List selectedDatas) {      ZcPProMake zcPProMake = (ZcPProMake) listCursor.getCurrentObject();      for (Object object : selectedDatas) {        ZcBAgency zcBAgency = (ZcBAgency) object;        zcPProMake.setAgency(zcBAgency.getZcAgeyCode());        zcPProMake.setAgencyName(zcBAgency.getZcAgeyName());        setEditingObject(zcPProMake);      }    }    @Override    public TableModel createTableModel(List showDatas) {      Object data[][] = new Object[showDatas.size()][columNames.length];      for (int i = 0; i < showDatas.size(); i++) {        ZcBAgency rowData = (ZcBAgency) showDatas.get(i);        int col = 0;        data[i][col++] = rowData.getZcAgeyCode();        data[i][col++] = rowData.getZcAgeyName();      }      MyTableModel model = new MyTableModel(data, columNames) {        public static final long serialVersionUID = 1821460782676810898L;        @Override        public boolean isCellEditable(int row, int colum) {          return false;        }        @Override        public Class getColumnClass(int column) {          if (column >= 0 && column < getColumnCount() && this.getRowCount() > 0) {            for (int row = 0; row < this.getRowCount(); row++) {              if (getValueAt(row, column) != null) {                return getValueAt(row, column).getClass();              }            }          }          return Object.class;        }      };      return model;    }    @Override    public boolean isMultipleSelect() {      return false;    }  }  /*   *    * 品牌选择外部部件处理类   */  public class ZcEbBrandHandler implements IForeignEntityHandler {    public String columNames[];    public ZcEbBrandHandler(String columNames[]) {      this.columNames = columNames;    }    public void excute(List selectedDatas) {      ZcPProMake make = (ZcPProMake) listCursor.getCurrentObject();      JTable table = itemTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitem item = (ZcPProMitem) model.getBean(k2);      String braCode = "", braName = "";      for (int i = 0; i < selectedDatas.size(); i++) {        ZcBBrand brand = (ZcBBrand) selectedDatas.get(i);        if (i == selectedDatas.size() - 1) {          braCode = braCode + brand.getZcBraCode();          braName = braName + brand.getZcBraName();        } else {          braCode = braCode + brand.getZcBraCode() + ",";          braName = braName + brand.getZcBraName() + ",";        }      }      if (selectedDatas.size() > 0) {        // 填充多个品牌        item.setZcBraCode(braCode);        item.setZcBraName(braName);        // 清空已有的商品        item.setZcMerCode(null);        item.setZcMerName(null);        // 清空已有的供应商        item.setZcSuCode(null);        item.setZcSuName(null);        ForeignEntityFieldCellEditor se = (ForeignEntityFieldCellEditor) table.getCellEditor(table.getSelectedRow(), table.getSelectedColumn());        se.getEditor().setValue(braName);      }      model.fireTableDataChanged();    }    @Override    public TableModel createTableModel(List showDatas) {      Object data[][] = new Object[showDatas.size()][columNames.length];      for (int i = 0; i < showDatas.size(); i++) {        ZcBBrand rowData = (ZcBBrand) showDatas.get(i);        int col = 0;        data[i][col++] = rowData.getZcBraCode();        data[i][col++] = rowData.getZcBraName();        data[i][col++] = rowData.getCountNum();      }      MyTableModel model = new MyTableModel(data, columNames) {        @Override        public boolean isCellEditable(int row, int colum) {          return false;        }      };      return model;    }    @Override    public boolean isMultipleSelect() {      return false;    }    public boolean beforeSelect(ElementConditionDto dto) {      JTable table = itemTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return false;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitem item = (ZcPProMitem) model.getBean(k2);      if (item.getZcCatalogueCode() == null) {        JOptionPane.showMessageDialog(self, "请先选择品目", "提示", JOptionPane.INFORMATION_MESSAGE);        return false;      }      /*       * 应夏处要求，先将商品品目/品牌/商品/规格等输入次序功能进行暂时屏蔽，改为可用手工填写       *        * Update By FengYan 2011-06-14       *        * if (item.getZcCatalogueCode() == null) {       *        * JOptionPane.showMessageDialog(self, "请先选择品目", "提示",       * JOptionPane.INFORMATION_MESSAGE);       *        * return false;       *        * } else {       *        *        *        * }       */      dto.setZcText0(item.getZcCatalogueCode());      return true;    }  }  /*   *    * 商品选择外部部件处理类   */  public class ZcEbMerHandler implements IForeignEntityHandler {    public String columNames[];    public ZcEbMerHandler(String columNames[]) {      this.columNames = columNames;    }    public void excute(List selectedDatas) {      JTable table = itemTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitem item = (ZcPProMitem) model.getBean(k2);      if (selectedDatas.size() > 0) {        ZcBMerchandise mer = (ZcBMerchandise) selectedDatas.get(0);        item.setZcMerCode(mer.getZcMerCode());        item.setZcMerName(mer.getZcMerName());        item.setZcMerPrice(mer.getZcMerMPrice());        // 清空已有的供应商        item.setZcSuCode(null);        item.setZcSuName(null);      }      model.fireTableDataChanged();    }    @Override    public TableModel createTableModel(List showDatas) {      Object data[][] = new Object[showDatas.size()][columNames.length];      for (int i = 0; i < showDatas.size(); i++) {        ZcBMerchandise rowData = (ZcBMerchandise) showDatas.get(i);        int col = 0;        data[i][col++] = rowData.getZcMerName();        data[i][col++] = rowData.getZcBraName();        data[i][col++] = rowData.getZcMerSpec();        data[i][col++] = rowData.getZcMerMPrice();      }      MyTableModel model = new MyTableModel(data, columNames) {        @Override        public boolean isCellEditable(int row, int colum) {          return false;        }      };      return model;    }    @Override    public boolean isMultipleSelect() {      return false;    }    public boolean beforeSelect(ElementConditionDto dto) {      JTable table = itemTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return false;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitem item = (ZcPProMitem) model.getBean(k2);      /*       * 应夏处要求，先将商品品目/品牌/商品/规格等输入次序功能进行暂时屏蔽，改为可用手工填写       *        * Update By FengYan 2011-06-14       *        * if (item.getZcBraCode() == null) {       *        * JOptionPane.showMessageDialog(self, "请先选择品牌", "提示",       * JOptionPane.INFORMATION_MESSAGE);       *        * return false;       *        * } else {       *        * dto.setZcText0(ZcBMerchandise.ENABLE);       *        * dto.setZcText1(item.getZcCatalogueCode());       *        * if (item.getZcBraCode().indexOf(",") == -1)       *        * dto.setZcText2(item.getZcBraCode());       *        * else {       *        * String[] brands = item.getZcBraCode().split(",");       *        * List brandList = null;       *        * for (int i = 0; i < brands.length; i++) {       *        *        *        * }       *        * }       *        * dto.setZcText4(item.getZcBraCode());       *        * return true;       *        * }       */      dto.setZcText0(ZcBMerchandise.ENABLE);      dto.setZcText1(item.getZcCatalogueCode());      if (item.getZcBraCode().indexOf(",") == -1)        dto.setZcText2(item.getZcBraCode());      else {        String[] brands = item.getZcBraCode().split(",");        List brandList = null;        for (int i = 0; i < brands.length; i++) {        }      }      dto.setZcText4(item.getZcBraCode());      return true;    }  }  /*   *    *    *    * <select id="sql_test" parameterclass="myPramBean" resultclass="myResult">   *    * select *from tablewhere name in   *    * <iterate property="ids" conjunction="," close=")" open="(" />   *    * #value[]#   *    * </iterate>   *    * and code=#code#   *    * </select>   */  /*   *    * 供应商选择外部部件处理类   */  public class ZcEbSupplierHandler implements IForeignEntityHandler {    public String columNames[];    public ZcEbSupplierHandler(String columNames[]) {      this.columNames = columNames;    }    public void excute(List selectedDatas) {      JTable table = itemTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitem item = (ZcPProMitem) model.getBean(k2);      if (selectedDatas.size() > 0) {        ZcEbSupplier su = (ZcEbSupplier) selectedDatas.get(0);        item.setZcSuCode(su.getCode());        item.setZcSuName(su.getName());      }      model.fireTableDataChanged();    }    @Override    public TableModel createTableModel(List showDatas) {      Object data[][] = new Object[showDatas.size()][columNames.length];      for (int i = 0; i < showDatas.size(); i++) {        ZcEbSupplier rowData = (ZcEbSupplier) showDatas.get(i);        int col = 0;        data[i][col++] = rowData.getName();        data[i][col++] = rowData.getLinkMan();        data[i][col++] = rowData.getLinkManPhone();        data[i][col++] = rowData.getAddress();      }      MyTableModel model = new MyTableModel(data, columNames) {        @Override        public boolean isCellEditable(int row, int colum) {          return false;        }      };      return model;    }    @Override    public boolean isMultipleSelect() {      return false;    }    public boolean beforeSelect(ElementConditionDto dto) {      JTable table = itemTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return false;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitem item = (ZcPProMitem) model.getBean(k2);      /*       * 应夏处要求，先将商品品目/品牌/商品/规格等输入次序功能进行暂时屏蔽，改为可用手工填写       *        * Update By FengYan 2011-06-14       */      // if (item.getZcMerCode() == null) {      // JOptionPane.showMessageDialog(self, "请先选择商品", "提示",      // JOptionPane.INFORMATION_MESSAGE);      // return false;      // }      // } else {      // dto.setZcText0(ZcEbSupplier.ENABLE);      // dto.setZcText1(item.getZcMerCode());      // dto.setZcText2(item.getZcBraCode());      // return true;      // }      dto.setZcText0(ZcEbSupplier.ENABLE);      dto.setZcText1(item.getZcMerCode());      dto.setZcText2(item.getZcBraCode());      return true;    }  }  /*   *    * 指标余额外部实体   */  private class ZcVBiDetailHandler implements IForeignEntityHandler {    private String columNames[];    public ZcVBiDetailHandler(String columNames[]) {      this.columNames = columNames;    }    public void excute(List selectedDatas) {      JTable table = biTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0)        return;      int k2 = table.convertRowIndexToModel(k);      ZcPProMitemBi item = (ZcPProMitemBi) model.getBean(k2);      if (selectedDatas.size() > 0) {        ZcVBiDetail detail = (ZcVBiDetail) selectedDatas.get(0);        item.setZcBiNo(detail.getZcBiNo());        item.setZcBiJhuaSum(detail.getZcBiDoSum());        item.setZcBiDoSum(detail.getZcBiDoSum());        item.setFundCode(detail.getZcFundCode());        item.setFundName(detail.getZcFundName());        item.setOriginCode(detail.getOrginCode());        item.setOriginName(detail.getOrginName());        item.setPaytypeCode(detail.getPaytypeCode());        item.setPaytypeName(detail.getPaytypeName());        item.setSenddocCode(detail.getSenddocCode());        item.setSenddocName(detail.getSenddocName());      }      model.fireTableDataChanged();    }    @Override    public TableModel createTableModel(List showDatas) {      Object data[][] = new Object[showDatas.size()][columNames.length];      for (int i = 0; i < showDatas.size(); i++) {        ZcVBiDetail rowData = (ZcVBiDetail) showDatas.get(i);        int col = 0;        data[i][col++] = rowData.getZcBiNo();        data[i][col++] = rowData.getZcBiDoSum();        data[i][col++] = rowData.getZcFundName();        data[i][col++] = rowData.getOrginName();        data[i][col++] = rowData.getPaytypeName();        data[i][col++] = rowData.getSenddocName();      }      MyTableModel model = new MyTableModel(data, columNames) {        @Override        public boolean isCellEditable(int row, int colum) {          return false;        }      };      return model;    }    @Override    public boolean isMultipleSelect() {      return false;    }    public boolean beforeSelect(ElementConditionDto dto) {      return true;    }  }  private void doPrint() {    this.requestMeta.setFuncId(this.printButton.getFuncId());    this.requestMeta.setPageType(getCompoId() + "_E");    try {      ZcPProMake bill = (ZcPProMake) this.listCursor.getCurrentObject();      if (!"exec".equals(bill.getZcMakeStatus())) {        JOptionPane.showMessageDialog(this, "单据终审之后才能进行打印！", "提示", JOptionPane.INFORMATION_MESSAGE);      }      String condition = " M.ZC_MAKE_CODE = '" + bill.getZcMakeCode() + "' ";      //			String condition = "[{M.ZC_MAKE_CODE='" + bill.getZcMakeCode() + "';}]";      //      PrintUtilities.print(getCompoId(bill), "mainTable_E", getPrintTemplateCode(bill), "A4", "sa", "",      //        com.ufgov.client.basis.util.WorkEnv.getInstance(), "", condition, null, null, false);    } catch (Exception e) {      logger.error(e.getMessage(), e);      JOptionPane.showMessageDialog(this, "打印出错！\n" + e.getMessage(), "错误", 0);    }  }  private String getPrintTemplateCode(ZcPProMake make) {    String result = "ZC_P_PRO_MAKE_XY_PRINT";    String fukuan = make.getZcFukuanType();    String makeSequence = make.getZcMakeSequence();    // Z01    if ("Z01".equals(fukuan)) {      if ("1".equals(makeSequence)) {        result = "ZC_P_PRO_MAKE_ZF_PRINT";      } else {        result = "ZC_P_PRO_MAKE_BM_PRINT";      }    } else if ("G01".equals(fukuan)) {      Integer num = (Integer) zcEbBaseServiceDelegate.queryObject("ZC_P_PRO_MAKE.getZcPProMitmemerIfExistsHongqi", make.getZcMakeCode(), requestMeta);      if (num != null && num > 0) {        result = "ZC_P_PRO_MAKE_XY_SPECIAL_PRINT";        return result;      }      result = "ZC_P_PRO_MAKE_XY_PRINT";    }    return result;  }  private String getCompoId(ZcPProMake make) {    String result = "ZC_P_PRO_MAKE";    String fukuan = make.getZcFukuanType();    // Z01    if ("G01".equals(fukuan)) {      result = "ZC_P_PRO_MAKE_XY";    }    return result;  }  private String getSql(ZcPProMake make) {    String result = "SELECT M.ZC_MAKE_CODE,M.ZC_MAKE_NAME,M.AGENCY_NAME,(SELECT v.VAL FROM as_val v WHERE v.VAL_ID=M.ZC_MAKE_SEQUENCE AND v.VALSET_ID='VS_ZC_ORGTYPE') ORG_TYPE,DECODE(M.ZC_MAKE_SEQUENCE, '1', '吉林省省级政府集中采购计划(任务)通知书', '2', '吉林省省级部门集中采购任务通知书','') TITLE,M.ZC_MONEY_BI_SUM,M.ZC_MAKE_LINKMAN,M.ZC_MAKE_TEL,B.ZC_BI_NO,(SELECT V.VAL FROM AS_VAL V WHERE V.VAL_ID = M.ZC_PIFU_CGFS AND V.VALSET_ID = 'ZC_EB_PUR_TYPE') PUR_TYPE,(SELECT A.CO_NAME FROM AS_COMPANY A WHERE A.CO_CODE = M.CO_CODE) CO_NAME,D.ZC_PITEM_NAME,d.ZC_CATALOGUE_NAME,d.ZC_CAIG_NUM,d.ZC_BASE_GGYQ,d.ZC_MER_PRICE,d.ZC_ITEM_SUM FROM ZC_P_PRO_MAKE M LEFT OUTER JOIN ZC_P_PRO_MITEM D ON M.ZC_MAKE_CODE = D.ZC_MAKE_CODE LEFT OUTER JOIN ZC_EB_ENTRUST E ON E.ZC_MAKE_CODE = M.ZC_MAKE_CODE LEFT OUTER JOIN ZC_P_PRO_MITEM_BI B ON M.ZC_MAKE_CODE = B.ZC_MAKE_CODE WHERE 1=1 and M.ZC_MAKE_CODE ='"      + make.getZcMakeCode() + "'";    String fukuan = make.getZcFukuanType();    // Z01    if ("G01".equals(fukuan)) {      result = "SELECT M.ZC_MAKE_CODE,M.ZC_MAKE_NAME,M.AGENCY_NAME,(SELECT v.VAL FROM as_val v WHERE v.VAL_ID=M.ZC_MAKE_SEQUENCE AND v.VALSET_ID='VS_ZC_ORGTYPE') ORG_TYPE,M.ZC_MONEY_BI_SUM,M.ZC_MAKE_LINKMAN,M.ZC_MAKE_TEL,B.ZC_BI_NO,(SELECT V.VAL FROM AS_VAL V WHERE V.VAL_ID = M.ZC_PIFU_CGFS AND V.VALSET_ID = 'ZC_EB_PUR_TYPE') PUR_TYPE,(SELECT A.CO_NAME FROM AS_COMPANY A WHERE A.CO_CODE = M.CO_CODE) CO_NAME,D.ZC_PITEM_NAME,d.ZC_CATALOGUE_NAME,(SELECT s.ZC_SU_NAME FROM ZC_B_SUPPLIER s WHERE s.ZC_SU_CODE=d.ZC_SU_CODE) SU_NAME,d.ZC_CAIG_NUM,d.ZC_BASE_GGYQ,d.ZC_MER_PRICE,d.ZC_ITEM_SUM FROM ZC_P_PRO_MAKE M LEFT OUTER JOIN ZC_P_PRO_MITEM D ON M.ZC_MAKE_CODE = D.ZC_MAKE_CODE LEFT OUTER JOIN ZC_EB_ENTRUST E ON E.ZC_MAKE_CODE = M.ZC_MAKE_CODE LEFT OUTER JOIN ZC_P_PRO_MITEM_BI B ON M.ZC_MAKE_CODE = B.ZC_MAKE_CODE WHERE 1=1 and M.ZC_MAKE_CODE ='"        + make.getZcMakeCode() + "'";    }    return result;  }  public ZcPProMake getPrintObject() {    ZcPProMake zcPProMake = (ZcPProMake) this.listCursor.getCurrentObject();    zcPProMake.setCoName(zcCoCode.getCompanyName());    List tempList = zcPProMake.getItemList();    for (int i = 0; i < tempList.size(); i++) {      ZcPProMitem item = (ZcPProMitem) tempList.get(i);      item.setTempId("" + (i + 1));    }    return zcPProMake;  }  private void doPrintPreview() {    this.requestMeta.setFuncId(this.printPreviewButton.getFuncId());    this.requestMeta.setPageType(this.getCompoId() + "_L");    try {      ZcPProMake make = (ZcPProMake) this.listCursor.getCurrentObject();      //      // String url = WorkEnv.getInstance().getWebRoot() +      // "/portal/page/print/toZcProMakeDetailPrint.do?code_array=" +      // zcPProMake.getZcMakeCode();      //      // ZcUtil.anyBrowse(url);      String condition = " M.ZC_MAKE_CODE = '" + make.getZcMakeCode() + "' ";      //      PrintUtilities.showPrintPreview(getCompoId(make), "mainTable_E", getPrintTemplateCode(make), "A4", "sa", "",      //        com.ufgov.client.basis.util.WorkEnv.getInstance(), "", condition, false, null, null, false);    } catch (Exception e) {      logger.error(e.getMessage(), e);      JOptionPane.showMessageDialog(this, "打印预览出错！\n" + e.getMessage(), "错误", 0);    }  }  private void doPrintSetting() {    this.requestMeta.setFuncId(this.printSettingButton.getFuncId());    this.requestMeta.setPageType(this.getCompoId() + "_L");    new PrintSettingDialog(this.requestMeta);  }  // 确认供货  private void doConfirmSupply() {    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());    Map parameter = new HashMap();    parameter.put("data", make);    // 确认是否供货    int num = JOptionPane.YES_OPTION;    num = JOptionPane.showConfirmDialog(this, "确认是否进行供货", "提示", 0);    if (num == JOptionPane.YES_OPTION) {      boolean success = true;      boolean fullConfirm = true;      ZcPProMake afterSaveBill = null;      String errorInfo = "";      try {        List itemList = make.getItemList();        if (itemList.size() == 0 || itemList == null) {          JOptionPane.showMessageDialog(this, "协议商品明细为空!", "提示", JOptionPane.INFORMATION_MESSAGE);        } else {          for (int i = 0; i < itemList.size(); i++) {            ZcPProMitem zcPProMitem = (ZcPProMitem) itemList.get(i);            if (null != zcPProMitem.getZcSuCode()) {              if (WorkEnv.getInstance().getCurrUserId().trim().equals(zcPProMitem.getZcSuCode().trim())) {                zcPProMitem.setZcIsChengJiao("2");                this.listPanel.getZcPProMakeServiceDelegate().updateZcPProMitemFN(zcPProMitem, requestMeta);              }            }            if (null != zcPProMitem.getZcSuCode()) {              if (!"2".equals(zcPProMitem.getZcIsChengJiao()))                fullConfirm = false;            }          }        }        afterSaveBill = listPanel.getZcPProMakeServiceDelegate().updateZcXYPProMakeFN(make, requestMeta);        // 更改协议单据状态        if (fullConfirm == true) {          make.setZcMakeStatus("confirm");          afterSaveBill = listPanel.getZcPProMakeServiceDelegate().updateZcXYPProMakeFN(make, requestMeta);        }      } catch (Exception e) {        success = false;        logger.error(e.getMessage(), e);        errorInfo += e.getMessage();      }      if (success) {        this.refreshAll(afterSaveBill, true);        JOptionPane.showMessageDialog(this, "确认供货成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.listPanel.refreshCurrentTabData();      } else {        JOptionPane.showMessageDialog(this, "确认供货失败！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      }    }  }  public void doJingjiaGongGao() {  }  public void doChengjiaoGongGao() {  }  // private Map wfCanEditFieldMap;  private boolean isEdit;  public void updateWFEditorEditable(WfAware baseBill, RequestMeta requestMeta) {    Long processInstId = baseBill.getProcessInstId();    isEdit = false;    if (processInstId != null && processInstId.longValue() > 0) {      // 工作流的单据            wfCanEditFieldMap = BillElementMeta.getWfCanEditField(baseBill, requestMeta);      if ("cancel".equals(this.oldZcPProMake.getZcMakeStatus())) {// 撤销单据设置字段为不可编辑        wfCanEditFieldMap = null;      }      // if ("0".equals(this.oldZcPProMake.getZcMakeStatus()))      // {//撤销单据设置字段为不可编辑      // isEdit = true;      // }      for (AbstractFieldEditor editor : fieldEditors) {        // 工作流中定义可编辑的字段        if (wfCanEditFieldMap != null && wfCanEditFieldMap.containsKey(Utils.getDBColNameByFieldName(editor.getEditObject(), editor.getFieldName()))) {          isEdit = true;          editor.setEnabled(true);        } else {          editor.setEnabled(false);        }      }      // 子表的设置      updateWFSubTableEditable();    }  }  protected void setButtonStatus(WfAware baseBill, RequestMeta requestMeta, ListCursor listCursor) {    Long processInstId = baseBill.getProcessInstId();    if (processInstId == null || processInstId.longValue() < 0) {      // 新增单据,草稿单据或不挂接工作流的单据      Component[] funcs = toolBar.getComponents();      String funcId;      for (Component func : funcs) {        funcId = ((FuncButton) func).getFuncId();        if ("fauditfinal" == funcId || "fcallback" == funcId || "fautocommit" == funcId || "funaudit" == funcId || "funtread" == funcId        || "fshowinstancetrace" == funcId || "f_uncollectcreate" == funcId || "fconfirmsup" == funcId // add shijia 去掉 "fnew" ==          // funcId ||          || "fmanualcommit" == funcId || funcId != null && funcId.startsWith("fmanualcommit")) {          func.setVisible(false);        }      }    } else if ("cancel".equals(this.oldZcPProMake.getZcMakeStatus())) {      Component[] funcs = toolBar.getComponents();      String funcId;      for (Component func : funcs) {        funcId = ((FuncButton) func).getFuncId();        if ("fauditfinal" == funcId || "fcallback" == funcId || "fautocommit" == funcId || "funaudit" == funcId || "funtread" == funcId        || "fshowinstancetrace" == funcId || "f_uncollectcreate" == funcId || "fnew" == funcId || "fconfirmsup" == funcId        || "fmanualcommit" == funcId || "fnew" == funcId || "fsave" == funcId || "fdelete" == funcId || "fnewcommit" == funcId        || "fcallback" == funcId || "funtread" == funcId || "fshowinstancetrace" == funcId || funcId != null && funcId.startsWith("fmanualcommit")) {          func.setVisible(false);        }      }    } else {      // 流程已经启动      List enableFuncs = this.getWFNodeEnableFunc(baseBill, requestMeta);      ZcUtil.setWfNodeEnableFunc(toolBar, enableFuncs, processInstId, requestMeta);    }    if (listCursor == null || listCursor.getDataList() == null || listCursor.getDataList().size() <= 1) {      // 如果listCursor中只有一条记录，就隐藏上一条下一条按钮      FuncButton previousButton = toolBar.getButtonByDefaultText("上一条");      FuncButton nextButton = toolBar.getButtonByDefaultText("下一条");      if (previousButton != null) {        previousButton.setVisible(false);      }      if (nextButton != null) {        nextButton.setVisible(false);      }    }    if ("sa".equals(WorkEnv.getInstance().getCurrUserId())) {      FuncButton button = toolBar.getButtonByDefaultText("保存");      button.setVisible(true);    }  }  protected void updateWFSubTableEditable() {    // 默认的方法是判断isEdit属性（主表中是否存在可编辑字段）,如果主表中存在可编辑字段，就设置从表字段都可编辑.    // 如果这个逻辑满足不了业务，可以在实现类里覆盖updateWFSubTableEditable方法，自己做判断.    if (getSubTables() != null) {      if (isEdit) {        for (JTablePanel tablePanel : getSubTables()) {          if (!deleteButton.isVisible()) {            setWFSubTableEditable(tablePanel, false);            continue;          }          setWFSubTableEditable(tablePanel, true);        }        setWFSubTableEditable(itemTablePanel, true);      } else {        for (JTablePanel tablePanel : getSubTables()) {          setWFSubTableEditable(tablePanel, false);        }      }    }  }  protected void updateWFSubTableEditable(boolean isEdit) {    // 默认的方法是判断isEdit属性（主表中是否存在可编辑字段）,如果主表中存在可编辑字段，就设置从表字段都可编辑.    // 如果这个逻辑满足不了业务，可以在实现类里覆盖updateWFSubTableEditable方法，自己做判断.    if (getSubTables() != null) {      if (isEdit) {        for (JTablePanel tablePanel : getSubTables()) {          setWFSubTableEditable(tablePanel, true);        }      } else {        for (JTablePanel tablePanel : getSubTables()) {          if ("sa".equals(WorkEnv.getInstance().getCurrUserId()) && tablePanel == biTablePanel) {            setWFSubTableEditable(tablePanel, true);            continue;          }          setWFSubTableEditable(tablePanel, false);        }      }    }  }  public void refreshJinJiaItemPanel() {    // TODO Auto-generated method stub  }  /*   *    * 从表的删除行方法   */  protected Integer[] deleteBiSub(JTablePanel tablePanel) {    JPageableFixedTable table = tablePanel.getTable();    Integer[] checkedRows;    // 是否显示行选择框    if (tablePanel.getTable().isShowCheckedColumn()) {      checkedRows = table.getCheckedRows();    } else {      int[] selectedRows = table.getSelectedRows();      checkedRows = new Integer[selectedRows.length];      for (int i = 0; i < checkedRows.length; i++) {        checkedRows[i] = selectedRows[i];      }    }    if (checkedRows.length == 0) {      JOptionPane.showMessageDialog(this, "没有选择数据！", "提示",      JOptionPane.INFORMATION_MESSAGE);    } else {      if (table.isEditing()) {        table.getCellEditor().stopCellEditing();      }      BeanTableModel tableModel = (BeanTableModel) table.getModel();      int[] selRows = new int[checkedRows.length];      for (int i = 0; i < selRows.length; i++) {        selRows[i] = table.convertRowIndexToModel(checkedRows[i]);      }      Arrays.sort(selRows);      for (int i = selRows.length - 1; i >= 0; i--) {        if (ZcUtil.useBudget()) {          ZcPProMitemBi bi = (ZcPProMitemBi) ((ZcPProMake) listCursor.getCurrentObject()).getBiList().get(selRows[i]);          if (bi.getZcBiNo() != null && !"".equals(bi.getZcBiNo())) {            getDto.setZcText3(getDto.getZcText3().replaceAll(",'" + bi.getZcBiNo() + "'", "").replaceAll("'" + bi.getZcBiNo() + "',", "")              .replaceAll("'" + bi.getZcBiNo() + "'", ""));          }        }        tableModel.deleteRow(selRows[i]);      }    }    fitColumnWidth(tablePanel.getTable());    return checkedRows;  }  protected void initOrg(ZcPProMake zcPProMake) {    MaCompanyKey key = new MaCompanyKey();    key.setNd(new BigDecimal(requestMeta.getSvNd()));    key.setCoCode(requestMeta.getSvCoCode());    MaCompany company = baseDataServiceDelegate.getCompanyByExampleKey(key, requestMeta);    if (company != null) {      zcPProMake.setOrgCode(company.getfOrgCode());    }    if (ZcSettingConstants.CAI_ZHENG_JU_CO_CODE.equals(requestMeta.getSvCoCode()) || zcPProMake.getOrgCode() == null) {      for (int i = 0; i < fieldEditors.size(); i++) {        AbstractFieldEditor comp = fieldEditors.get(i);        if (comp.isVisible() && "orgCode".equals(comp.getFieldName())) {          comp.setEnabled(true);        }      }    }  }}